I submitted an custom keyboard which was rejected by apple for this reason
2.10: iPhone Apps must also run on iPad without modification, at iPhone resolution, and at 2X iPhone 3GS resolution
My intention was to develop only for iPhones(but apple had other ideas),but when I checked the custom keyboard in iPad it was covering only the half of the keyboard length,say like 320 Width.
The things I did
Followed AppCoda tutorial ,but developed in Obj C.
Did not use NSAutolayout constraints as everything I handled in XIB's,which had Width of 320 and height of 220
- Checked the keyboard in all iPhone models and it is working fine except the iPads
And I tried this code
UIView *topView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 50)];
topView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"background"]];
UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
[leftButton setTranslatesAutoresizingMaskIntoConstraints:NO];
[leftButton setTitle:@"right " forState:UIControlStateNormal];
[topView addSubview:leftButton];
[self.view addSubview:topView];
NSLayoutConstraint *topC = [NSLayoutConstraint constraintWithItem:leftButton attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:topView attribute:NSLayoutAttributeTop multiplier:1.0 constant:1.0];
NSLayoutConstraint *rightC = [NSLayoutConstraint constraintWithItem:leftButton attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:topView attribute:NSLayoutAttributeRight multiplier:1.0 constant:1.0];
NSLayoutConstraint *bottomC = [NSLayoutConstraint constraintWithItem:leftButton attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:topView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-1.0];
[topView addConstraints:@[topC,rightC,bottomC]];
And I got this output ScreenShot.This is the exact layout am getting for my keyboard when opened in iPad.So Where am I going wrong? All the tutorials are shown in iPhone and it seems to work in iPad as well but not my keyboard.