我正在构建登录/注册页面,它的工作非常完美。
但我只是想知道如何在登录页面上为“忘记我的密码或用户名”添加标签或按钮。
请注意我正在使用解析。
谢谢,
答案 0 :(得分:0)
首先显示类型为UIAlertViewStylePlainTextInput
的警报视图 UIAlertView * forgotPassword=[[UIAlertView alloc] initWithTitle:@"Forgot Password" message:@"Please enter your email id" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Ok", nil];
forgotPassword.alertViewStyle=UIAlertViewStylePlainTextInput;
[forgotPassword textFieldAtIndex:0].delegate=self;
[forgotPassword show];
并在警报视图中委托
if(buttonIndex ==1){
NSLog(@"ok button clicked in forgot password alert view");
NSString *femailId=[alertView textFieldAtIndex:0].text;
if ([femailId isEqualToString:@""]) {
UIAlertView *display;
display=[[UIAlertView alloc] initWithTitle:@"Email" message:@"Please enter password for resetting password" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles: nil];
[display show];
}else{
[PFUser requestPasswordResetForEmailInBackground:femailId block:^(BOOL succeeded, NSError *error) {
UIAlertView *display;
if(succeeded){
display=[[UIAlertView alloc] initWithTitle:@"Password email" message:@"Please check your email for resetting the password" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles: nil];
}else{
display=[[UIAlertView alloc] initWithTitle:@"Email" message:@"Email doesn't exists in our database" delegate:nil cancelButtonTitle:@"Cancel" otherButtonTitles: nil];
}
[display show];
}];
}