我在单元格表视图的每个单元格中添加了图像。我不能设置我的图像框架请帮助我这样做。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UIImageView *myImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, lblzip.frame.size.height+lblzip.frame.origin.y+2,30,30)];
myImageView.tag = 120;
myImageView.image = [UIImage imageNamed:@"call.png"];
[cell.imageView setContentMode:UIViewContentModeScaleAspectFit];
cell.imageView.image=myImageView.image;
cell.imageView.userInteractionEnabled=YES;
UITapGestureRecognizer *tapped = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imageSelectedInTable:)];
[cell.imageView addGestureRecognizer:tapped];
[tapped release];
}
但我的图像宽度和高度不是 30。它像资源文件中的图像。
我的研究给了我一个使用布局子视图的想法。如何调用和使用它们
-(void)layoutsubviews
{
}