iphone - 一个对象可以作为多个委托(delegate)人的委托(delegate)吗?

标签 iphone objective-c delegates

我不确定这里的术语,但是:

我在 iPhone 应用程序中有一个 ViewController,它需要成为其他两个对象(委托(delegate)者)的委托(delegate)。

这可能吗?这不起作用:

@interface my_projectViewController : UIViewController <DelegatorOne> <DelegatorTwo> {
  ...
}

最佳答案

正确的复数形式是 delegates 是的,绝对可以让您的类成为不同协议(protocol)的委托(delegate)。

语法是这样的:

@interface my_projectViewController : UIViewController <DelegatorOne, DelegatorTwo> {
  ...
}

我有一个看起来像这样的:

@interface MyViewController : UIViewController<UITextFieldDelegate,UIWebViewDelegate,UINavigationBarDelegate,UIActionSheetDelegate,URLDownloaderDelegate> {

}

最好的问候,

关于iphone - 一个对象可以作为多个委托(delegate)人的委托(delegate)吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1264561/

相关文章:

ios - 在 iPad 上运行 iPhone 应用程序时四周出现黑条

ios - iOS中如何获取按时间范围修剪后的视频?

iOS - NSJSON 序列化 : Unable to convert data to string around character

iphone - 在 iPhone 上横向全屏播放 YouTube,纵向内嵌播放 YouTube

c# - 无法分配给委托(delegate)具有不太具体的参数类型的匿名方法

ios - 在 iTunes 上隐藏额外的本地化

ios - 如何设置每两周一次本地通知

ios - 通过委托(delegate)方法携带自定义属性

C# 委托(delegate)给结构方法

iphone - 获取 UISwitch 行的 NSIndexPath