我有一个家庭视图,当点击它再次进入另一个视图时我将转到另一个视图。当点击该视图上的按钮时,将出现模态视图,然后在点击每个视图时再显示3个模态视图modalview。当点击最终的模态视图时,会出现一个警告,当点击该警报我想要显示根主视图。是否可能 ?
答案 0 :(得分:1)
使用给定的代码段显示AlertView:
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:标题消息:@“Alert Message” delegate:self cancelButtonTitle:@“Ok”otherButtonTitles:nil]; [警示显示]; [警告发布];
委托方法实施:
}
答案 1 :(得分:0)
以下给出的示例代码:
UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:@"Alert Message?" message:@"Error......" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK"] autorelease];
[alert show];
实现警报View的委托函数如下所示
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 0)
{
//cancel clicked ...do your action
}
else if (buttonIndex == 1)
{
//OK clicked
[self.navigationController popToViewController animated:YES];
}
}
答案 2 :(得分:0)
int c=[self.navigationController.viewControllers count]-4;
[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:c] animated:YES];
答案 3 :(得分:0)
只需在.h文件中给代表,然后在alertview的委托方法中写下波纹管代码..
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 1) {
[self.navigationController popToRootViewControllerAnimated:YES];///this line is important..
}
else{
// do your action...
}
}
我希望这个答案对你有用..
:)