【发布时间】:2015-12-13 11:23:31
【问题描述】:
我尝试将单元格上的图片视为一个圆圈 而我不能。 最近我来到这个椭圆
这是我的代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
cell.imageView.clipsToBounds = YES;
cell.imageView.layer.cornerRadius = cell.imageView.frame.size.width / 2.0;
cell.imageView.layer.borderWidth = 2.0;
cell.imageView.layer.borderColor = [UIColor blueColor].CGColor;
cell.imageView.image=[UIImage imageWithData:[picCoreData valueForKey:@"image"]];//i get the picture from core data.
return cell;
}
【问题讨论】:
-
您的图像视图的大小是否为正方形意味着宽度 = 高度?
-
我不知道,单元格是一种类型的字幕,我试图用 NSRange 得到它给我的大小 0
-
尝试在调整 imageView 之前设置图像以具有cornerRadius - 我认为字幕单元格中的 imageView 正在为您设置的每个图像设置 imageView 大小。
-
我试过了,还是椭圆
标签: ios objective-c