我有一個customTableViewCell
,我想設置一個圖像和一些文本。該單元格已成功創建,但屬性爲nil
。我不確定在.xib
中是否有某些我錯過的東西,但我無法弄清楚。該網點是在customViewCell
的.h
設置和連接在.xib
CustomTableViewCell屬性沒有被設置(它們爲零)
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellIdentifier = @"socialMediaCell";
CustomSocialMediaTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
CustomSocialMediaTableViewCell *tagCell = (CustomSocialMediaTableViewCell*)[tableView dequeueReusableCellWithIdentifier:@"socialMediaCell"];
if (cell == nil) {
cell = [[CustomSocialMediaTableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
tagCell = [[CustomSocialMediaTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
}
NSData* imageData = [[NSUserDefaults standardUserDefaults] objectForKey:@"socialPosts"];
UIImage* image = [UIImage imageWithData:imageData];
cell.socialMediaTextView.text = @"TEXT";
cell.socialMediaImageView.image = image;
return cell;
}
化妝確定你的網點是@Property .. –
請更正問題的代碼格式... –
cellIdentifier = @「socialMediaCell」或cellIdentifier = @「CustomSocialMediaTableViewCell」? –