开发者

how to define two delegates in the @interface line

In iOS,I would like to include both a delegate for the flipsideView (from a Utility Application template) and a delegate to allow to scroll the view. My attempt, which does not work, is:

@interface MainViewController : UIViewController 
<FlipsideViewControllerDelegate> <UIScrollViewDelegate> {
 }
开发者_运维百科

I tried to place a comma (,) or a space between the two <>, but it does not work. Would someone be able and willing to help me concerning this question?

Thank you in advance for your help


Do it this way:

@interface MainViewController : UIViewController 
  <FlipsideViewControllerDelegate, UIScrollViewDelegate> 
{

}

The syntax is as follows:

@interface ClassName : ItsSuperclass < protocol list >

For example for multiple protocols:

@interface Formatter : NSObject < Formatting, Prettifying >

You can read more on protocols and how to adopt and conform in Apple's official Documentation.


Only one <> is required with comma separating the protocols.

@interface MainViewController : UIViewController 
<FlipsideViewControllerDelegate, UIScrollViewDelegate> {
 }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜