我已经搜索了允许我在单击警报视图上的按钮后转移到新页面的方法。我必须使用 prepareForSegue 方法吗?或者有没有更简单的方法?
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if(buttonIndex ==0){
//code goes here
}
if(buttonIndex ==1){
NSString *username = [[alertView textFieldAtIndex:0] text];
NSString *password = [[alertView textFieldAtIndex:1] text];
NSLog(@"Username:%@",username);
NSLog(@"Password:%@",password);
//Check if username and password tally if tally move on to Menu page
MainPageViewController *anotherController = [[MainPageViewController alloc] initWithNibName:@"AnotherView" bundle:nil];
[self.navigationController pushViewController:anotherController animated:YES];
}
}