Accessing Method from other Classes Objective-C

前端 未结 8 1525
挽巷
挽巷 2020-11-29 05:57

Looked for an answer for this question, but I haven\'t found a suitable one yet. I\'m hoping you guys (and gals) can help me out! (This is for an iPhone app)

Alrig

8条回答
  •  萌比男神i
    2020-11-29 06:44

    There are some answers here telling you to create a common "parent" class. However I think that you can do a lot better. Create a category for UIViewController instead. You don't know all of the internals of what is going on with UIViewController so I don't think it is worth creating your own View Controller hierarchy off of. In fact it could be dangerous. I ran into a number of problems when I tried to create a "base" UITableViewController and then create classes that inherit from that. I avoided these problems by using categories instead.

    Your #1 priority shouldn't be inheriting things for no good reason, it should be getting an app into the app store that people will want to download.

提交回复
热议问题