如何使ViewController符合多种协议?

Mos*_*she 4 iphone protocols objective-c

我想要包含Core Location,我正在尝试遵循本教程:http://www.mobileorchard.com/hello-there-a-corelocation-tutorial/我正在使用SDK 3.2.2.

@interface MainViewController : UIViewController <FlipsideViewControllerDelegate>{ 是现在的代码.

Ale*_*ski 10

如果您希望一个类符合多个协议,您只需<>用逗号分隔s中的协议名称:

@interface MyClass : TheSuperclass <Protocol1, Protocol2, Protocol3>
    ...
@end
Run Code Online (Sandbox Code Playgroud)

等等.

在你的情况下:

@interface MainViewController : UIViewController <FlipsideViewControllerDelegate, CLLocationManagerDelegate>
    ...
@end
Run Code Online (Sandbox Code Playgroud)