1

I have a custom cell,and it has a image in it..and I am accessing that image in this way in

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

So now I want to know how can i get the hieght and width of this "special image"..

Waiting for your reply

Rais Alam
  • 6,892
  • 12
  • 51
  • 84
Ranjit
  • 4,656
  • 11
  • 58
  • 120

3 Answers3

2

I think you are searching for that size:

CGRect size = [tableCell specialImage].bounds.size;
Nekto
  • 17,789
  • 1
  • 52
  • 65
1

As per comments, I'd expect the following to work:

 CGSize specialImageSize = [[tableCell specialImage] size];

If that doesn't work, you'll need to post more code for more help. For example, if the above doesn't work, it'd be helpful to know more about what I assume is a UITableViewCell subclass pointed to by tableCell.

Obliquely
  • 6,822
  • 2
  • 30
  • 50
1

Please try below code:

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];
Saran
  • 6,136
  • 3
  • 38
  • 44