Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone-自定义手机-无法设置UILabel_Iphone_Uitableview - Fatal编程技术网

Iphone-自定义手机-无法设置UILabel

Iphone-自定义手机-无法设置UILabel,iphone,uitableview,Iphone,Uitableview,我尝试在UITableView的自定义单元格中设置值。但是当我启动它时,没有错误,但是我的值没有在UILabel中设置 你有什么想法 自定义单元格: @interface InscriptionCustomCell : UITableViewCell { IBOutlet UILabel *titreCell; IBOutlet UITextField *contenuCell; } 使用我的UITableView查看: // Customize the appearance of tabl

我尝试在UITableView的自定义单元格中设置值。但是当我启动它时,没有错误,但是我的值没有在UILabel中设置

你有什么想法

自定义单元格:

@interface InscriptionCustomCell : UITableViewCell {

IBOutlet UILabel *titreCell;
IBOutlet UITextField *contenuCell;
}

使用我的UITableView查看:

// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:  (NSIndexPath *)indexPath {

static NSString *CellIdentifier = @"InscriptionCustomCell";

InscriptionCustomCell *cell = (InscriptionCustomCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {

    NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"InscriptionCustomCell" owner:self options:nil];

    for (id currentObject in topLevelObjects){
        if ([currentObject isKindOfClass:[UITableViewCell class]]){
            cell =  (InscriptionCustomCell *) currentObject;
            break;
        }
    }
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;

if(indexPath.section == 0)
{
    [cell.titreCell setText:[model.listModuleInfoPerso objectAtIndex:indexPath.row]];
    [cell.contenuCell setPlaceholder:[model.listModuleInfoPerso objectAtIndex:indexPath.row]];
}else {
    [cell.titreCell setText:[model.listModuleInfoSupp objectAtIndex:indexPath.row]];
    [cell.contenuCell setPlaceholder:[model.listModuleInfoSupp objectAtIndex:indexPath.row]];
}
return cell;

}

正如Pratikshabisikar所说,将nib中的标签连接到课堂上的插座

然后使用UILabel.text属性设置标签文本

cell.yourCustomLabel.text = @"text";


另外,在创建问题时,请使用标准的苹果术语作为标签。例如:ios、uikit等。

确保标签在nib中连接到相应的插座。我在我的博客上发表了一篇关于使用自定义单元格的文章,可能对您有用
NSString * labelText = [something...];
cell.yourCustomLabel.text = labelText;