Overwrite method inside an objective-c class as in Java

后端 未结 1 334
离开以前
离开以前 2021-01-28 22:39

I often use this statement for extending class without needs of writing a whole separate file. Supposing ClassFromFramework is a class being part of a framework included in libr

1条回答
  •  广开言路
    2021-01-28 23:27

    You can make a new subclass, and override methods, but all new classes must be in their own .h & .m files. That's how Obj-C operates. In this case, it would make sense to have the additional files.

    You can also call the parent method with the word super. This is done all the time when subclassing a ViewController, such as in viewDidLoad.

    0 讨论(0)
提交回复
热议问题