objective c - Should I declare the methods my class implements from a protcol? -
Assume that I have a purpose-class that corresponds to a protocol. In the class, I apply some methods in the protocol. Should I declare these methods in class expansion or should I save it from it?
Example < Div class = "post-text" itemprop = "text"> The protocol has the necessary and optional methods. When a protocol method is optional, you should declare it in class detail or in the interface section of the class. This lets you compile the stability for you. When implementing the necessary methods, such as
// MyViewController.h @interface MyViewController: UIViewController & LT; UITableViewDataSource & gt; @end // MyViewController.m @ Interface MyViewController () // Should I Leave It? - (NSInteger) Table view: (UITableView *) table view numberoffer these inclusions: (NSInteger) section; @end @implementaion MyViewController - (NSInteger) TableView: (UITableView *) table view numberAffros Insight: (NSInteger) section {// implementation goes here} @end
tableview: numberOfRowsInSection: , you can be used on the basis of coding standards. I like to declare these methods well - either in a class extension or in the interface itself. In this way I do not need to check whether a method is needed or not.
Comments
Post a Comment