我有一个在计算单元中有一个ImageView的NSTableViewCell。
使用代码控制图像在单元格中的位置需要什么?
发布于 2013-02-23 19:00:11
如果您使用的是NSTextFieldCell(ImageAndTextCell)的子类。你可以控制图像的位置
- (NSRect)imageRectForBounds:(NSRect)cellFrame方法。
发布于 2013-02-24 02:11:25
可以创建自定义单元格...
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"ImageOnRightCell";
UIImageView *photo;
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]];
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
photo = [[[UIImageView alloc] initWithFrame:CGRectMake(225.0, 0.0, 80.0, 45.0)]];
photo.tag = PHOTO_TAG;
photo.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleHeight;
[cell.contentView addSubview:photo];
} else {
photo = (UIImageView *)[cell.contentView viewWithTag:PHOTO_TAG];
}
return cell;
}这看起来就像...

或者你可以阅读这个链接...http://developer.apple.com/library/ios/#documentation/userexperience/conceptual/tableview_iphone/TableViewCells/TableViewCells.html
发布于 2013-02-23 18:29:08
创建您自己的自定义TableViewCell并根据需要定位它,而不是默认的tableViewCell。
https://stackoverflow.com/questions/15038644
复制相似问题