在 iPhone 应用程序中添加 2 个以上的代表 [英] Adding More Than 2 Delegates in iPhone App
问题描述
这是一个比我更熟悉 Objective-C 的人可以快速回答的简单问题——如何向一个类添加 2 个以上的代表?
This is a simple question that can be answered fast by someone who's more familiar with Objective-C than I am- how can one add more than 2 delegates to a Class?
澄清一下,我习惯于将委托放在这样的类中:
To clarify, I'm used to putting delegates in classes like this:
@interface ViewController : UIViewController
当我尝试放置两个代表时:
When I try to put two delegates:
@interface ViewController : UIViewController
...该应用程序给出了许多错误,但都没有帮助解决这种情况.
...the app gives many errors, none of which help with the situation.
我需要在代表之间放置一个分隔符,还是可能有两个以上的分隔符?
Is there a separator that I need to put between the delegates, or is it possible at all to have more than two?
提前感谢您的帮助.
推荐答案
实现多个协议的类的正确声明是逗号分隔列表
The correct declaration for a class that implements multiple protocols is a comma separated list
@interface ViewController : UIViewController <UIWebViewDelegate, UITextFieldDelegate>
{ ...
这篇关于在 iPhone 应用程序中添加 2 个以上的代表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!