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,970
  • 12
  • 53
  • 84
Ranjit
  • 4,576
  • 11
  • 62
  • 121

3 Answers3

2

I think you are searching for that size:

CGRect size = [tableCell specialImage].bounds.size;
Nekto
  • 17,837
  • 1
  • 55
  • 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
  • 7,002
  • 2
  • 32
  • 51
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,274
  • 3
  • 39
  • 48