NikkyD
NikkyD

Reputation: 2284

UIView is 1 pixel wider than its frame is (iPhone 6)

I have some spacer lines between things.

UIView * lineView = [[UIView alloc] initWithFrame: CGRectMake(x, 0, 1, h)];
lineView.backgroundColor = [UIColor colorWithRed:1 green:1 blue:1 alpha:0.5f];
[self addSubview:lineView];

On iPhone 4S, 5 and iPad mini they all are 1 pixel (2 with retina) wide. On iPhone 6 however (even in simulator) the fifth line is 3 pixels wide and i have no idea why. (i magnify with real phone cam)

The frames show

{{ 85, 0}, {1, 32}}
{{184, 0}, {1, 32}}
{{284, 0}, {1, 32}}
{{383, 0}, {1, 32}}
{{483, 0}, {1, 32}} // this is 1.5 wide (3 pixels)

Now if i make them 2 pt wide, the 1st and 2nd are 4 pix (iPhone 6) but the 3rd, 4th and 5th are 5 pix wide.

What could be stretching those UIViews ?

Upvotes: 0

Views: 243

Answers (1)

rmaddy
rmaddy

Reputation: 318774

The most likely issue is that your app is being scaled on the iPhone 6 (and 6+). Apps that do not fully support the iPhone 6/6+ screen sizes will be scaled by iOS to fill the screen. The net result of this scaling is that rows and columns of pixels get duplicated in the scaling process.

The best solution is to add full support for the iPhone 6 and 6+ by adding the appropriate launch images and/or the new iOS 8 "Launch Screen file". Of course you then need to be sure your app is designed to take advantage of the larger screens.

Upvotes: 2

Related Questions