Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/118.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何将多个代理添加到视图控制器?_Ios - Fatal编程技术网

Ios 如何将多个代理添加到视图控制器?

Ios 如何将多个代理添加到视图控制器?,ios,Ios,如何将多个代理添加到视图控制器?我需要有多个代理,和。这是我目前的it系统,它只允许我有一个: #import <UIKit/UIKit.h> #import <MessageUI/MessageUI.h> @interface FifthViewController : UIViewController <MFMailComposeViewControllerDelegate> @property (weak, nonatomic) IBOutlet U

如何将多个代理添加到视图控制器?我需要有多个代理,
。这是我目前的it系统,它只允许我有一个:

#import <UIKit/UIKit.h>
#import <MessageUI/MessageUI.h>

@interface FifthViewController : UIViewController <MFMailComposeViewControllerDelegate>

@property (weak, nonatomic) IBOutlet UITextField *subjectfield;
@property (weak, nonatomic) IBOutlet UITextField *explainfield;
- (IBAction)sendbutton:(id)sender;
@property (weak, nonatomic) IBOutlet UITextField *BCCfield;

@property (weak, nonatomic) IBOutlet UITextField *name;



@end
#导入
#进口
@接口FifthViewController:UIViewController
@属性(弱,非原子)IBUITextField*subjectfield;
@属性(弱,非原子)IBOutlet UITextField*解释字段;
-(iAction)sendbutton:(id)发送者;
@属性(弱,非原子)IBUITEXTFIELD*BCCFELD;
@属性(弱,非原子)IBOutlet UITextField*名称;
@结束

我尝试过使用逗号和空格,但是当我有多个委托时,我得到了错误“expected identifier”。

括号内应该有逗号分隔的协议。例如

@interface FifthViewController : UIViewController <MFMailComposeViewControllerDelegate, UITextViewDelegate>
@interface FifthViewController:UIViewController

括号内应该有逗号分隔的协议。例如

@interface FifthViewController : UIViewController <MFMailComposeViewControllerDelegate, UITextViewDelegate>
@interface FifthViewController:UIViewController
带有逗号

@interface MyViewControllerName : UIViewController <ProtocolOne, ProtocolTwo,
   ProtocolThree, ProtocolFour, IveSeenAsManyAsTenProtocols, YouCanAddAllYouWant>
@接口MyViewControllerName:UIViewController
必须导入这些协议的头文件。

带有逗号

@interface MyViewControllerName : UIViewController <ProtocolOne, ProtocolTwo,
   ProtocolThree, ProtocolFour, IveSeenAsManyAsTenProtocols, YouCanAddAllYouWant>
@接口MyViewControllerName:UIViewController

必须导入这些协议的头文件。

逗号分隔可以,请确保导入定义委托的任何框架/类。请澄清-您没有在此处添加委托。您告诉编译器您的视图控制器符合列出的协议(MFMailComposeViewControllerDelegate和UITextViewDelegate)。您没有将委托添加到视图控制器,您将使视图控制器成为MFMailComposeViewController和UITextView的委托。逗号分隔可以,请确保导入定义委托所需的任何框架/类。只是澄清一下-您没有在此处添加委托。您告诉编译器您的视图控制器符合列出的协议(MFMailComposeViewControllerDelegate和UITextViewDelegate)。您没有将委托添加到视图控制器,而是将视图控制器设置为MFMailComposeViewController和UITextView的委托。如果我有两个控制器要从中委托,该怎么办?例如:
@interface MyViewControllerName:UIViewController,CustomController
我不明白这个问题:请看一下这个问题:如果我有两个控制器可以从中委派任务,会怎么样?例如:
@interface MyViewControllerName:UIViewController,CustomController
我不明白这个问题:请看一下这个