我想知道是否可以将某种图标/图像分配给iPad应用程序中UISplitViewController左侧的导航表格单元格。
例如,第1行旁边的图像...
http://www.cre8ive.kr/blog/wp-content/uploads/SplitViewTest_03.png
我正在尝试通过编辑
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath; 方法。
这是我得到的
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
cell.textLabel.text = [NSString stringWithFormat:@"%i", indexPath.row +1];
//Let the magic happen here :D
UIImage *image = [UIImage imageNamed:@"deviantart_dark.png"];
//Nothing changes :(
[[cell imageView] setImage:image];
return cell;
}有什么想法吗?
发布于 2011-10-28 13:05:05
你可以使用下面的代码,
cell.contentView.backgroundColor = [UIColor colorWithPatternImage:[UIImage:imageNamed:@"deviantart_dark.png"]];https://stackoverflow.com/questions/7925243
复制相似问题