I'm tuning my UI App, but I got an issue that I can't solve.
As I can see Compact height affects all iPhones under 4.7 inches, but my UI is fine except for the iPhone 4S (3.5 inches).
I don't want to modify the layout for all iPhones under 4.7 inches, just the iPhone 4S, at the same time I don't want to left out this device.
There's any workaround so I can set the amendments but just and only for the 3.5 inches portrait? or should I say goodbye to 100 millions devices out there?
I know it's a tough question and almost an opinion poll, but technically speaking I would like to find my best way out here.
There is no size class for iPhone 3.5 inch.
So I've made a class category for NSLayoutConstraint to edit it in Interface Builder which is very easy to use:
@interface NSLayoutConstraint (Extensions)
@property (nonatomic) IBInspectable CGFloat iPhone3_5_Constant;
@end
–
@implementation NSLayoutConstraint (Extensions)
- (CGFloat)iPhone3_5_Constant
{
return self.constant;
}
- (void)setIPhone3_5_Constant:(CGFloat)iPhone3_5_Constant
{
if ([UIScreen mainScreen].bounds.size.height < 500) {
self.constant = iPhone3_5_Constant;
}
}
@end