2011-09-09 21 views
1

我有一个自定义单元格图像的高度和宽度,以及它在it..and我以这种方式访问​​ 该图像中如何获得放置在一个自定义单元格中的ios

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
[[tableCell specialImage] setImage:[UIImage imageNamed:@"One.png"]]; 
} 
一个图像

所以现在我想知道我怎样才能得到hieght而这种“特殊的形象”的宽度..

等待你的答复

+0

参见本[文章](http://stackoverflow.com/questions/5249664/iphone如何获得高度和宽度的uiimage) – Saran

+0

谢谢萨兰,,为我们的快速回复..我会通过它 – Ranjit

+0

但saran多数民众赞成在工作.. – Ranjit

回答

1

按照意见,我希望以下以工作:

CGSize specialImageSize = [[tableCell specialImage] size]; 

如果这不起作用,您需要发布更多代码以获取更多帮助。例如,如果上述方法不起作用,那么了解更多关于我认为是tableCell指向的UITableViewCell子类的内容会很有帮助。

1

请尝试以下代码:

UIImage *imageThatIsSpecial = [UIImage imageNamed:@"One.png"]; 

NSLog(@"Image height is %f and its width is %f",imageThatIsSpecial.size.height, imageThatIsSpecial.size.width); 

[[tableCell specialImage] setImage:imageThatIsSpecial]; 
2

我认为你正在寻找的是尺寸:

CGRect size = [tableCell specialImage].bounds.size; 
相关问题