0

Possible Duplicate:
iOS 5.1 with Xcode 4.3.1: [UIColor colorWithPatternImage:] strange behavior only on device

Hi I've got a weird one here (I think).

I have an app where I have a uitableview which has been working fine. I've been re-developing and updated my iphone to IOS 5.1. Whether that is a red-herring or not, I don't know. Anyway I notice that the bottom row of pixels of my background/selected image is missing!

((UIImageView *)cell.backgroundView).image = [UIImage imageNamed:@"myBg1.png"];
((UIImageView *)cell.selectedBackgroundView).image = [UIImage imageNamed:@"myBg2.png"];

I've reduced the app to a simple UIImageView at the top of the screen....

enter image description here

The purple area is a UIImageView. The grey area with yellow border is my image that ultimately will act as the b/g for my table row. All looks good in IB.

Now, when I run it on the iPhone, I get this...

enter image description here

The bottom row of pixels (yellow border) is missing. No special resizing is done on this in code, it's just as IB places it, except the View Mode is changed to Top instead of ScaleToFill. In theory the image is left untouched.

In IB, an iPad(5.01), an iPod (4.2.1) and simulators, all works fine and the complete image is shown!

Can anyone shed any light on this, offer a solution? I'm pulling my hair out!

Thanks

Fitto

Community
  • 1
  • 1
Fittoburst
  • 2,215
  • 2
  • 21
  • 33

3 Answers3

2

Fixed it! I took off compression for the png I was using as the image.

Found the answer via this link...

iOS 5.1 with Xcode 4.3.1: [UIColor colorWithPatternImage:] strange behavior only on device

Wasted a day and a half, but now works a dream.

Community
  • 1
  • 1
Fittoburst
  • 2,215
  • 2
  • 21
  • 33
0

Maybe setting the cell's row-height + enabling the 'custom' row height should help (in Interface Builder - or the same in code). Or simply the height what you give back in (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath is not correct. It definitely seems like a height problem.

UITableViewCell Row Height in Interface Builder

Viktor Benei
  • 3,447
  • 2
  • 28
  • 37
  • Thanks but no. Forget the fact that this was an attempt to get a cell in a table working. That's just background info. Basically this is an image being displayed in a UIImageView via IB and on a plain view. – Fittoburst May 03 '12 at 16:02
0

Another thing what could be wrong: what's the 'View - Mode' of the Image View?

I mean this one:

View mode setting in Interface Builder

Viktor Benei
  • 3,447
  • 2
  • 28
  • 37
  • View Mode is 'Top'. I've tried all options. Each one seems to lose bottom row of pixels on iphone 5.1 only. – Fittoburst May 03 '12 at 20:07
  • Have you tried on device as well? Also: is your image sized to power-of-two width and height? – Viktor Benei May 04 '12 at 09:05
  • Yes, if you read the above, you will see screenshots in IB and from iphone running 5.1. As I said, works ok with ipod and ipad, both with IOS less than 5.1 – Fittoburst May 04 '12 at 13:42