我想要实现的是在单击警报视图按钮时转到另一个视图。我的警报视图在我的 loadingView 中,这个警报视图是从另一个名为 classA 的类中调用的。
这就是它在 A 类中的调用方式。
[LoadingViewController showError];
这是 loadingView 类的 loadingView 中的方法。
+ (void)showDestinationError{
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Error"
message:@"Error"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles: nil];
alert.tag = DEST_ERR;
[alert show];
}
按钮动作
+ (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if(alertView.tag = DEST_ERR){
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:[NSBundle mainBundle]];
UINavigationController *secondView = [storyboard instantiateViewControllerWithIdentifier:@"NavigationController"];
secondView.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[secondView presentModalViewController:secondView animated:YES];
}
}