【问题标题】:App crashes when using AHAlertView project使用 AHAlertView 项目时应用程序崩溃
【发布时间】:2013-02-02 15:29:04
【问题描述】:

我正在尝试显示自定义 UIAlertView 并且我正在使用 AHAlertView:

https://github.com/warrenm/AHAlertView

我将 AHAlertView.m 和 .h 添加到我的项目中,并将以下内容添加到 viewDidLoad 方法中:

        NSString *title = @"Alert View Title";
    NSString *message = @"This is a message that might prompt you to do something.";

    AHAlertView *alert = [[AHAlertView alloc] initWithTitle:title message:message];
    __weak AHAlertView *weakAlert = alert;
    [alert setCancelButtonTitle:@"Cancel" block:^{
        weakAlert.dismissalStyle = AHAlertViewDismissalStyleTumble;
    }];
    [alert addButtonWithTitle:@"OK" block:^{
        weakAlert.dismissalStyle = AHAlertViewDismissalStyleZoomDown;
    }];
    [alert show];

问题是,当我点击任一按钮时,应用程序崩溃: "应用程序窗口在应用程序启动结束时应该有一个根视图控制器"

我不知道我做错了什么,我查看了示例项目,这就是警报的使用方式。 如何正确实现?

【问题讨论】:

    标签: objective-c custom-controls


    【解决方案1】:

    您是否激活了 -fno-objc-arc 选项?如果你这样做了,请停用它,AHAlertView 支持 ARC

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多