在使用委托函数
开始登录之前,我会在登录过程中放置代码来设置用户名 - (BOOL)logInViewController:(PFLogInViewController *)logInController
shouldBeginLogInWithUsername:(NSString *)username
password:(NSString *)password
我认为我需要为我的b2b应用程序提供唯一的用户名;这是针对不同公司,这家公司可以有相同的用户名。从上面开始,我将pfuser中的用户名设置为"公司ID" +" _" +"用户ID",因为我尝试设置输入的用户名用户在PFLogInViewController上进行登录验证。
我创建了PFLogInViewController的自定义子类:
#import "PFLogInViewControllerFSB.h"
@interface PFLogInViewControllerFSB ()
@end
@implementation PFLogInViewControllerFSB
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
UIColor *color = [UIColor lightGrayColor];
self.logInView.usernameField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:NSLocalizedStringFromTable(@"login_txt_user", @"Generales",nil) attributes:@{NSForegroundColorAttributeName: color}];
self.logInView.passwordField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:NSLocalizedStringFromTable(@"login_txt_password", @"Generales",nil) attributes:@{NSForegroundColorAttributeName: color}];
self.logInView.logo = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 50)];
UILabel *labelLogo = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 50)];
labelLogo.text = @"Catch Sales";
[labelLogo setTextAlignment:NSTextAlignmentCenter];
[labelLogo setTextColor:[UIColor lightGrayColor]];
[labelLogo setFont:[UIFont fontWithName:@"Helvetica" size:30]];
[self.logInView.logo addSubview:labelLogo];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
@end