简体   繁体   English

如何在iPhone中两个独立的uiview之间调用协议?

[英]How to call the protocol between two independent uiview in Iphone?

i am declare the protocol in one UIView class i want to implement the protocol method in another UIView class. 我在一个UIView类中声明协议,而我想在另一个UIView类中实现协议方法。 but the protocol method does not call what can i do. 但协议方法未调用我该怎么办。 Any one Help me 有人帮我 上载UIview类

宣言

在此处输入图片说明

实现Uiview类

设置代表尊重的观点

协议实施

Did you call the delegate function in UploadView? 您是否在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];
    }
    ...
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM