修改ALBBOpenAccountSetPwdViewController.xib,增加需要的字段
在ALBBOpenAccountSetPwdViewController.h中增加并连线xib界面中新添加的控件IBOutlet
创建子类ALBBOpenAccountCustomSetPwdViewController,子类继承ALBBOpenAccountSetPwdViewController
@interface ALBBOpenAccountCustomSetPwdViewController : ALBBOpenAccountSetPwdViewController
@end
//设置子类
id<ALBBOpenAccountUIService> sr = ALBBService(ALBBOpenAccountUIService); [sr setRegisterFillPasswordClazz:[ALBBOpenAccountCustomSetPwdViewController class]];
//子类实现以下可选方法
@implementation ALBBOpenAccountCustomSetPwdViewController -(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:NSStringFromClass([self.superclass class]) bundle:nibBundleOrNil]; return self; } -(NSDictionary *)getUpdatedOpenAccountProfile { return @{@"CUSTOMR":@"CUSTOMER"}; } - (IBAction)advanceSubmitEnable:(id)sender { self.submitButton.enabled = self.passwordField.text.length > 6; } - (IBAction)focusNextOrResign:(UITextField *)sender { } - (IBAction)handleCustomAction:(id)sender { } @end
getUpdatedOpenAccountProfile用于设置自定义的数据
-(NSDictionary *)getUpdatedOpenAccountProfile { NSString *company = self.companyField.text; return @{@"companyName":company}; }
目前支持的 Profile 列表
属性名 键值 类型 头像 avatarUrl String 显示名 displayName String 姓名 name String 性别 gender Integer 1男 2女 生日 birthday String 旺旺 wangwang String 微信 weixin String 地区,用于国际化 locale String 记录创建的位置 createLocation String 扩展json extInfos String 支付宝id alipayId String 银行卡号 bankCardNo String 银行卡拥有者姓名 bankCardOwnerName String 国家名称 country String 公司名称 companyName String
advanceSubmitEnable用于设置提交按钮的状态
首先需要新添加的控件的状态变更都绑定至advanceSubmitEnable
每次控件状态变更都会触发advanceSubmitEnable方法
focusNextOrResign用与设置textfield之间焦点的切换
首先需要将新添加textField的Did End on Exit绑定至focusNextOrResign
focusNextOrResign代理方法中控制textfield焦点的变化 - (IBAction)focusNextOrResign:(UITextField *)textField { if (textField == self.passwordField) { [textField resignFirstResponder]; [self.companyField becomeFirstResponder]; } }
handleCustomEvent处理相关逻辑,比如处理submit按钮的状态
- (IBAction)handleCustomAction:(id)sender { NSString *company = self.companyField.text; if ([sender isKindOfClass:[UIButton class]] && company.length == 4) { self.submitButton.enabled = YES; } }
[ALBBService(ALBBOpenAccountService) updateAccountProfile:@{@"displayName":@"xxx",@"gender":@(1)} Callback:^(NSError *error) { if (error) { [MyAlertView alert:[NSString stringWithFormat:@"更新数据失败 \n error:%@", error]]; } else { [MyAlertView alert:[NSString stringWithFormat:@"更新成功 \n user:%@", [[ALBBOpenAccountSession sharedInstance] getUser]]]; } }];
Profile参数的键值参考Profile 列表,如果没有登录态的情况下调用此接口,error code会返回555