Put delegate methods into a category

后端 未结 2 1662
有刺的猬
有刺的猬 2021-02-12 15:09

I developed some application \'till now. Now I\'m writing a new one and in this project I want to keep the code very clean, so it\'s very easy to find the methods.
I want to

2条回答
  •  野的像风
    2021-02-12 15:45

    You don't have to create an entirely separate named protocol in a different file if you're only using it against one class. In fact, you probably shouldn't because it's just confusing.

    If you want to keep your primary class' .h file clean, just move this:

    @interface DetailViewController (Protocols) 
    
    @end
    

    into your primary .m file above the @implementation

    I don't see why you wouldn't want to declare in your .h that your primary class implements the tableview delegate and datasource protocols, though. They're descriptive.

提交回复
热议问题