Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.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
Uialertview xcode alertView教程在模拟器上返回空白_Uialertview - Fatal编程技术网

Uialertview xcode alertView教程在模拟器上返回空白

Uialertview xcode alertView教程在模拟器上返回空白,uialertview,Uialertview,刚接触xcode和obj-c,我花了两天时间试图解决这个问题 这是我的alertViewController.h #import <UIKit/UIKit.h> @interface alert_ViewController : UIViewController <UIAlertViewDelegate> @end 我在模拟器上运行这个项目,结果是空白的。有什么想法吗? 谢谢你能发布到教程的链接吗?教程是针对xcode 4的,这只是其中的一个小插曲。我的问题是为什么vi

刚接触xcode和obj-c,我花了两天时间试图解决这个问题

这是我的alertViewController.h

#import <UIKit/UIKit.h>
@interface alert_ViewController : UIViewController <UIAlertViewDelegate>
@end
我在模拟器上运行这个项目,结果是空白的。有什么想法吗?
谢谢

你能发布到教程的链接吗?教程是针对xcode 4的,这只是其中的一个小插曲。我的问题是为什么viewDidAppear从未被调用?我的代码放错地方了吗?真奇怪。需要查看代码的其余部分才能对此进行注释。的可能重复项
#import "ViewController.h"
@implementation alert_ViewController

- (void)viewDidAppear:(BOOL)animated{

    [super viewDidAppear:animated];
    self.view.backgroundColor = [UIColor whiteColor];
    NSString *message = @"Are you sure?";
    UIAlertView *alertView = [[UIAlertView alloc]
                              initWithTitle: @"Proceed?"
                              message:message
                              delegate:self
                              cancelButtonTitle: @"No"
                              otherButtonTitles: @"Yes", nil];
    [alertView show];
}
@end