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

时间:2014-09-12 09:31:54

标签: uialertview

xcode和obj-c的新手,我花了两天时间试图解决这个问题!

这是我的alertViewController.h

#import <UIKit/UIKit.h>
@interface alert_ViewController : UIViewController <UIAlertViewDelegate>
@end

我的alertViewController.m

#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

我在模拟器上运行项目,它出现空白。有任何想法吗? 谢谢

0 个答案:

没有答案