이 코드를 사용하며 호출을 반환 할 수 없습니다 (if 문에 오류가 있기 때문에 오류가 발생했습니다). 나는이 진술이 필요하다. 어떻게 해결할 수 있습니까?if 문에서 UITableViewCell
static NSString *cellIdentifierCell = @"Cell";
static NSString *cellIdentifierCol = @"Col";
WallPost *wallPost = self.dataSource[indexPath.row];
if ([wallPost.images count] >= 2)
{
AFTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifierCol];
if (cell == nil)
{
cell = [[AFTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifierCol];
}
}
if ([wallPost.images count] < 2)
{
FeedCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifierCell];
if (cell == nil)
{
cell = [[FeedCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifierCell];
//some code
}
cell.cellTextLabel.text = wallPost.text;
cell.cellTextLabel.numberOfLines = 0;
cell.cellLikeLabel.text = [NSString stringWithFormat:@"%@", wallPost.likesCount];
cell.cellCommentsLabel.text = [NSString stringWithFormat:@"%@", wallPost.commentsCount];
cell.cellDateLabel.text = [NSString stringWithFormat:@"%@", wallPost.pubDate];
}
밖에서 선언 –
@MidhunMP MP, 어떻게 그들이 할 수있는 동일한 이름과 다른 유형 이자형? – user3486428
'{}'안에 변수를 선언하면 대괄호 바깥 쪽에서 변수를 볼 수 없습니다. 'if' 문 앞에 변수를 선언하고 그것들을 nil로 설정하십시오. ** 이것은 Objective-C를 사용하기 전에 알아 두어야 할 매우 기본적인 C 언어입니다. ** –