简体   繁体   English

用子类覆盖类的父类

[英]Overriding the parent of a class with a subclass

I am looking for an efficient way to override the parent class of a UITableViewController. 我正在寻找一种有效的方法来覆盖UITableViewController的父类。 The parent class of UITableViewController is UIViewController. UITableViewController的父类是UIViewController。 I have a subclass of UIViewController which is called SpecialViewController . 我有一个UIViewController的子类,称为SpecialViewController I would like to make a subclass of UITableViewController called SpecialTableViewController . 我想做一个UITableViewController的子类,叫做SpecialTableViewController How can I achieve this? 我该如何实现?

UIViewController -> SpecialViewController -> UITableViewController -> SpecialTableViewController

Or am I breaking some rules? 还是我违反了一些规则?

I don't think its possible at compiletime. 我认为在编译时不可能。 But its possible at runtime. 但它可能在运行时。 Take a look here: Dynamically change an object's superclass 在这里看看: 动态更改对象的超类

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM