我是目標 c 的新手。我正在嘗試實作自定義 UITableViewDataSource 和委托。
我創建了一個 NSObject 子類并添加了以下代碼。
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface TableViewDataSourceDelegate : NSObject <UITableViewDelegate, UITableViewDataSource>
@end
NS_ASSUME_NONNULL_END
我收到這個錯誤。
Cannot find interface declaration for 'UIViewController', superclass of 'TableViewDataSourceDelegate'
我錯過了什么?
uj5u.com熱心網友回復:
嘗試添加
#import <UIKit/UIKit.h>
UI*類是UIKit. 不是Foundation。您可以只匯入UIKit和洗掉Foundation,因為前者依賴于后者并自動匯入它。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/329171.html
