【问题标题】:iOS 7 : Call method from subclassed UIAlertViewiOS 7:从子类 UIAlertView 调用方法
【发布时间】:2014-04-16 12:11:55
【问题描述】:

我创建了一个 UIAlertView 的子类,我在其中重写了以下方法:

- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated;

问题是尽管我点击了警报视图上的任何按钮,但并未调用此方法。可能是什么问题? iOS 7 是否不允许继承 UIAlertView?请帮忙。

【问题讨论】:

  • 你想通过子类化UIAlertView来完成什么?
  • 我添加了一个自定义视图,其中包含几个文本字段来提醒视图。警报视图上有两个按钮:提交和取消。在点击“提交”时,如果用户输入错误,我不希望警报视图被关闭。
  • 您查看过alertViewStyleUIAlertViewStyleLoginAndPasswordInputalertViewShouldEnableFirstOtherButton: 委托方法应该能够为您实现这一点。

标签: objective-c ios7 subclass uialertview


【解决方案1】:

从不支持子类化 UIAlertView。

UIAlertView Class Reference

子类化注释

UIAlertView 类旨在按原样使用,不支持子类化。此类的视图层次结构是私有的,不得修改。

【讨论】:

    【解决方案2】:

    来自UIAlertView Class Reference

    The UIAlertView class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified.
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-09
      • 2011-10-24
      • 1970-01-01
      • 2013-11-03
      • 1970-01-01
      • 2011-01-05
      相关资源
      最近更新 更多