Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/117.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
Objective c UIAlertView带有链接备用ViewController的按钮_Objective C_Ios_Cocoa Touch_Uiviewcontroller_Uialertview - Fatal编程技术网

Objective c UIAlertView带有链接备用ViewController的按钮

Objective c UIAlertView带有链接备用ViewController的按钮,objective-c,ios,cocoa-touch,uiviewcontroller,uialertview,Objective C,Ios,Cocoa Touch,Uiviewcontroller,Uialertview,我需要一个按钮,使一个带有操作的UIAlertView弹出 一旦警报弹出,它需要有一个按钮取消并停留在同一页面上,还有一个按钮将您链接到另一个ViewController 这是我从一些论坛拼凑出来的,但我不知道我在做什么,它给了我大约9条错误消息。请帮忙 -(IBAction)Alert:(id)sender { UIAlertView *Alert = [[UIAlertView alloc] initWithTitle:@"Alert"

我需要一个按钮,使一个带有操作的UIAlertView弹出

一旦警报弹出,它需要有一个按钮取消并停留在同一页面上,还有一个按钮将您链接到另一个ViewController

这是我从一些论坛拼凑出来的,但我不知道我在做什么,它给了我大约9条错误消息。请帮忙

-(IBAction)Alert:(id)sender {
    UIAlertView *Alert =  [[UIAlertView alloc] initWithTitle:@"Alert" 
                                              message:@"Warning! By entering the Tutorial, all data will be lost. Are you sure you want to continue?" 
                                             delegate:self 
                                    cancelButtonTitle:@"Return to Data Collection" 
                                    otherButtonTitles:@"Continue", nil];
    [Alert Show];
    [Alert Release];
}  

第一个代码框起作用,因此当我按下主屏幕上的一个按钮时,会弹出一个带有两个按钮的警报

但是,我无法使用第二个按钮将我链接到下一个ViewController

  • Objective-C是区分大小写的

    [Alert show];
    [Alert release];
    

    (如果重命名这些方法,您认为它可以如何工作?)

  • 如果(Alert.tag==0){

  • 为什么不在此处传递nib文件的名称:
    Tutorial*Info=[[Tutorial alloc]initWithNibName:nil bundle:nil];

  • 请遵守编码惯例。对象以camelCase命名

  • 结论
    从一开始就为你准备一本好书或一段视频

  • Objective-C是区分大小写的

    [Alert show];
    [Alert release];
    

    (如果重命名这些方法,您认为它可以如何工作?)

  • 如果(Alert.tag==0){

  • 为什么不在此处传递nib文件的名称:
    Tutorial*Info=[[Tutorial alloc]initWithNibName:nil bundle:nil];

  • 请遵守编码惯例。对象以camelCase命名

  • 结论

    从一开始就给你一本好书或一段视频来学习。这样做。

    将nil传递给nibName很好-在这种情况下,它只加载名称与类名匹配的nib-Tutorial.xib。当然,如果nib没有被调用,那么你会有问题。将nib传递给nibName很好-它只加载名称与类名匹配的nib-Tuto当然,如果nib不是那样的话,那么你就有问题了。
    - (void)alertView:(UIAlertView *)Alert clickedButtonAtIndex:(NSInteger)buttonIndex