登录验证前无法更改用户名值

时间:2014-08-13 13:37:45

标签: ios xcode5 parse-platform pfloginviewcontroller pfuser

在使用委托函数

开始登录之前,我会在登录过程中放置​​代码来设置用户名
 - (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

0 个答案:

没有答案