내 표보기 셀로 사용하려는 xib가있는 UITableViewCell의 하위 클래스가 있습니다. 셀 단위로 셀의 속성을 수정해야합니다. 여기 내 코드가있다. NSLog는 속성이 올바르게 변경되었음을 보여 주지만, 앱을 실행하면 usernameLabel이 xib 파일의 자리 표시 자와 동일하게 유지됩니다. 도움과 행복한 축하에 감사드립니다.UITableViewCell이 속성을 수정하지 않습니다.
-(UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath {
static NSString *simpleTableIdentifier = @"SimpleTableItem";
// ActivityCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
LiveCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil) {
// Load the top-level objects from the custom cell XIB.
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"LiveCell" owner:self options:nil];
// Grab a pointer to the first object (presumably the custom cell, as that's all the XIB should contain).
cell = [topLevelObjects objectAtIndex:0];
}
if (dataLoaded == YES) {
cell.usernameLabel = [[UILabel alloc] init];
NSLog(@"Data Cell Loaded");
PFObject *liveObject = [tableData objectAtIndex:indexPath.row];
cell.usernameLabel.text= liveObject[@"Name"];
NSLog(@"Name Label: %@", cell.usernameLabel.text);
return cell;
}
else {
return cell;
}
}
'cell.usernameLabel = [[UILabel alloc] init]'은 비현실적입니다. –