UItableViewCell 型の式で 'CustomCellView *' を初期化する互換性のないポインタ型 質問する

UItableViewCell 型の式で 'CustomCellView *' を初期化する互換性のないポインタ型 質問する

以下のエラーを理解して修正するのを手伝っていただけますか。CustomCellViewが のサブクラスであることがわかりませんUItableViewCell。コードはコンパイルされますが、警告はまだ表示されます。

Incompatible pointer type initializing 'CustomCellView *' with an expression of type `UItableViewCell`

以下の 2 行目がハイライトされました:

static NSString *CellIdentifier = @"CustomCell";
CustomCellView *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

ベストアンサー1

static NSString *CellIdentifier = @"CustomCell";
CustomCellView *cell =(CustomCellView*) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

セルにキャストする必要があります

おすすめ記事