Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MACloop

macrumors 6502
Original poster
May 18, 2009
393
0
Germany
Hello,
I do some download in my app where some of the data are images. In my app I save this data and create uiimages object where needed. Everything works fine so far. My problem is:
I have a custom tableViewCell class and in this class I have a UIImageView defined. No matter which size I set to this Uiimageview, the image put into it gets the height of the tablecell. I have tried to change the viewMode for the cell uiimageview content but without any luck so far. What can I do to actually get the images to be displayed with the size of the uiimageview it is added into...?

The images is created like this:
Code:
NSFileManager *fileManager = [[NSFileManager alloc]init];
	UIImage *imgToUse = [[UIImage alloc] initWithData:[fileManager contentsAtPath:[dict objectForKey:@"data_path"]]];
	[fileManager release];

After this the images is saved into a dictionary and in the table delegate method
Code:
- (UITableViewCell *)tableView:(UITableView *)t cellForRowAtIndexPath:(NSIndexPath *)indexPath {
the image is added to the imageView, like this:
Code:
cell.imageView.image = [[self.imageDict objectForKey:@"some key here"];

Any Ideas? I do not understand why the cell height controls the image height? What am I doing wrong?
Thanks in advance!
MACloop
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
The apple provided tableview cells have their own rules about size and positions of their labels and imageview. If you write a subclass and override layoutSubviews you can adjust the imageview according to your rules.
 

MACloop

macrumors 6502
Original poster
May 18, 2009
393
0
Germany
The apple provided tableview cells have their own rules about size and positions of their labels and imageview. If you write a subclass and override layoutSubviews you can adjust the imageview according to your rules.

Ah, I did not know that! Thanks a lot - I will take a look at it in the documentation. I was assuming I could treat it like a normal image and that did not work :)
MACLoop
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.