的高度,我在heightForRowAtIndexPath-
問題雖然發現的UITableViewCell
我的完整方法計算細胞的高度編程是:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
id cell = [self.tableView dequeueReusableCellWithIdentifier:kCellID];
if([cell isKindOfClass:[Custom class]])
{
return 100;
}
else
{
return 20;
}
}
我的應用程序需要3-5
秒顯示的視圖控制器。儘管調用了cellForRowAtIndexPath
,我可以在控制檯中顯示日誌。
但我的ViewController未加載。
當剛剛返回使用此代碼的應用程序的高度正常工作:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return 100;
}
我不知道這是這一行的問題:
id cell = [self.tableView dequeueReusableCellWithIdentifier:kCellID];
什麼,我在這個問題上失蹤?
看到這個http://stackoverflow.com/questions/18206448/how-can-i-get-the-height-of-a-specific-row-in-my-uitableview和http://stackoverflow.com/questions/13968316/get-uitableviewcells-height-after-setting-height-for-each-uitableviewcell –
@ Anbu.Karthik我需要找到細胞的類型,因爲我有兩種類型的細胞。這是主要問題。每當我使用代碼來查找單元格類型時,我的應用程序開始延遲 – Dalvik
爲什麼不使用屬性isTableViewWithCustomCells或isTableViewWithOtherCustomCells?它應該更快。我認爲可以在cellForRowAtIndexPath和出隊的東西之前調用'heightForRowAtIndexPath:'。 – Larme