Maison  >  Questions et réponses  >  le corps du texte

ios - storyboard中TableViewController无法调用自定义类

class AAA ViewConntroller, UITableViewController后
storyboard中TableViewController无法使用AAA这个类

但是
我在storyboard中新添加ViewController容器后,在这个容器里再加入TableView就可以使用AAA这个类

这是什么原因?
ViewConntroller, UITableViewController 不是并列的吗?

PHP中文网PHP中文网2741 Il y a quelques jours511

répondre à tous(1)je répondrai

  • 天蓬老师

    天蓬老师2017-04-18 09:46:08

    UITableViewController hérite de UIViewController et ajoute les deux protocoles <UITableViewDelegate, UITableViewDataSource> TBVC est une sous-catégorie de VC, pas une relation parallèle comme vous l'avez mentionné. Regardez le code

    NS_ASSUME_NONNULL_BEGIN
    
    NS_CLASS_AVAILABLE_IOS(2_0) @interface UITableViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>
    
    - (instancetype)initWithStyle:(UITableViewStyle)style NS_DESIGNATED_INITIALIZER;
    - (instancetype)initWithNibName:(nullable NSString *)nibNameOrNil bundle:(nullable NSBundle *)nibBundleOrNil NS_DESIGNATED_INITIALIZER;
    - (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER;
    
    @property (nonatomic, strong, null_resettable) UITableView *tableView;
    @property (nonatomic) BOOL clearsSelectionOnViewWillAppear NS_AVAILABLE_IOS(3_2); // defaults to YES. If YES, any selection is cleared in viewWillAppear:
    
    @property (nonatomic, strong, nullable) UIRefreshControl *refreshControl NS_AVAILABLE_IOS(6_0) __TVOS_PROHIBITED;
    
    @end
    
    NS_ASSUME_NONNULL_END
    

    répondre
    0
  • Annulerrépondre