如何在Iphone中的两个独立uiview之间调用协议? [英] How to call the protocol between two independent uiview in Iphone?

查看:78
本文介绍了如何在Iphone中的两个独立uiview之间调用协议?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

i am declare the protocol in one UIView class i want to implement the protocol method in another UIView class. but the protocol method does not call what can i do. Any one Help me

推荐答案

您是否在UploadView中调用了委托函数?
另外,由于它是可选功能,你必须在调用它之前检查委托对该函数的响应。

Did you call the delegate function in UploadView? Also, since it is optional function, you have to check if the delegate response to the function before calling it.

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

这篇关于如何在Iphone中的两个独立uiview之间调用协议?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆