UITableViewCell annexView不显示
我完全不确定为什么我的辅助视图不起作用。我只是希望一些文本出现在UITableViewCell的右侧(以及左侧),但仅显示左侧的文本。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:@\"SwitchCell\"];
if (cell==nil){
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@\"SwitchCell\"] autorelease];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(5, 0, 60, 30)];
cell.textLabel.text = @\"left text\";
label.text = @\"right text\";
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.accessoryView = label;
[label release];
}
return cell;
}
有任何想法吗?谢谢。
没有找到相关结果
已邀请:
5 个回复
拟僚疽刊剔
您正在将AccessoriesView设置为标签,这样就不会看到任何公开指示器。如果要在单元格中显示标题和详细信息文本,请使用UITableViewCellStyleValue2像这样初始化它...
...然后像这样设置标题和详细信息...
要了解不同的内置表格样式,请查看以下图片... 您可以调整textLabel和detailTextLabel以适合您的口味。
净爽
粱委教
在iOS 3.0中已贬值 而是使用:
传入
或
并根据需要设置
和
属性。 http://developer.apple.com/library/ios/#documentation/uikit/reference/UITableViewCell_Class/Reference/Reference.html%23//apple_ref/doc/uid/TP40006938-CH3-SW34
瞥同忙接
怪酞撩匹