Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/115.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iOS开发人员:按警报中的按钮继续?_Ios_Cocoa Touch_Uialertview - Fatal编程技术网

iOS开发人员:按警报中的按钮继续?

iOS开发人员:按警报中的按钮继续?,ios,cocoa-touch,uialertview,Ios,Cocoa Touch,Uialertview,我已经搜索了几个小时,没有找到任何答案,所以我非常感谢你的帮助 我正在设计一个应用程序,当按下警报中的按钮时,需要切换到不同的视图控制器。我已经设置了警报,但只需要代码就可以切换到新视图 执行UIAlertViewDelegate,然后您会收到一个回调,当警报解除时,按下该按钮。只需调用performsguewithidentifier 有关详细信息,请参见实施UIAlertViewDelegate,然后您会收到一个回调,当警报解除时,该回调按钮被按下。只需调用performsguewithid

我已经搜索了几个小时,没有找到任何答案,所以我非常感谢你的帮助


我正在设计一个应用程序,当按下警报中的按钮时,需要切换到不同的视图控制器。我已经设置了警报,但只需要代码就可以切换到新视图

执行
UIAlertViewDelegate
,然后您会收到一个回调,当警报解除时,按下该按钮。只需调用
performsguewithidentifier


有关详细信息,请参见实施
UIAlertViewDelegate
,然后您会收到一个回调,当警报解除时,该回调按钮被按下。只需调用
performsguewithidentifier


更多详细信息,请参见实现
UIAlertViewDelegate
并添加方法
alertView:ClickedButtonIndex:
。单击右按钮后,调用该方法进入新视图

实现
UIAlertViewDelegate
并添加方法
alertView:ClickedButtonIndex:
。单击右按钮后,调用该方法进入新视图

试试这个。首先创建alertview

UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:@"Message"  message:@"Open New controller?" delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes",nil];
[alertView show];
[alertView release];
实现AlertView委托方法

#pragma mark AlertView Delegate
-(void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    if (buttonIndex != alertView.cancelButtonIndex)
    {
        Viewcontroller *vc = [[UIViewcontroller alloc] initWithNib:@"Viewcontroller"];
        [self presentModalViewController:vc];
        [vc release];
    }
}

试试这个。首先创建alertview

UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:@"Message"  message:@"Open New controller?" delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes",nil];
[alertView show];
[alertView release];
实现AlertView委托方法

#pragma mark AlertView Delegate
-(void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    if (buttonIndex != alertView.cancelButtonIndex)
    {
        Viewcontroller *vc = [[UIViewcontroller alloc] initWithNib:@"Viewcontroller"];
        [self presentModalViewController:vc];
        [vc release];
    }
}