【发布时间】:2012-12-15 07:25:38
【问题描述】:
我有一个自定义UITableViewCell 中的UIImageView,我想调整它的大小,我将它的查看模式设置为左。要调整大小,我正在应用以下代码。
[cell.IBImage setFrame:CGRectMake(201,12,50,20)];
我的图像宽度是 100,我想减小到 50,但它仍然显示为 100 宽度。如果我将查看模式设置为Scale To Fill,它可以正常工作,但我希望将其查看模式设置为 LEFT。
完整的方法 cellForRowAtIndexPath 如下:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"DetailCell";
DetailCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"DetailCell" owner:self options:nil];
cell = (DetailCell *)[topLevelObjects objectAtIndex:0];
clsDetailResponse *Response = [self.Histories objectAtIndex:[indexPath row]];
[cell.IBUsernameLabel setText:[NSString stringWithFormat:@"%@ %@", Response.Firstname, Response.Lastname]];
[cell.IBImage setFrame:CGRectMake(201, 12, 50, 20)];
return cell;
}
【问题讨论】:
-
你在哪里辞职..在延迟加载技术中加载图像后
-
@Rajneesh071 抱歉,我没有收到您的问题...
-
你在哪里调整它的大小..请提供更多代码
-
@Rajneesh071 我正在调整它的大小 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath ,如果我将视图模式设置为 Scale To Fill 问题,它工作正常仅适用于左视图模式
-
可以粘贴cellforrow的代码吗
标签: iphone objective-c ios uiimageview uiimage