【问题标题】:How to call the protocol between two independent uiview in Iphone?如何在Iphone中调用两个独立的uiview之间的协议?
【发布时间】:2012-06-14 01:09:03
【问题描述】:

我在一个 UIView 类中声明协议,我想在另一个 UIView 类中实现协议方法。但协议方法并没有调用我能做什么。哪位帮我

【问题讨论】:

  • 请发布示例代码。
  • 嗨,maulik 更新了我的问题
  • 您的代码看起来正确,请检查delegate 是否不为零。
  • 仅供参考,当您包含不应使用图像的代码时,您应该将代码作为文本放入您的问题中。
  • hello skram 如何检查委托不为零

标签: iphone ios ios5 uiview


【解决方案1】:

您是否在 UploadView 中调用了委托函数? 此外,由于它是可选函数,因此您必须在调用之前检查委托是否响应该函数。

- (void)yourFunction {
    ...
    if ([self.delegate respondsToSelector:@selector(takeAnotherPhoto:)]) {
        [delegate takeAnotherPhoto:self];
    }
    ...
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-07-19
    • 2012-07-21
    • 1970-01-01
    • 1970-01-01
    • 2022-08-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多