我提交了一个自定义键盘,因此被苹果拒绝
2.10:iPhone 应用程序也必须在 iPad 上运行,无需修改,以 iPhone 分辨率和 2X iPhone 3GS 分辨率运行
我的意图是只为 iPhone 开发(但苹果有其他想法),但是当我检查 iPad 中的自定义键盘时,它只覆盖了键盘长度的一半,比如 320 宽度。
我做过的事情
遵循AppCoda教程,但使用 Obj C 开发。
没有使用 NSAutolayout 约束作为我在 XIB 中处理的所有内容,其宽度为 320,高度为 220
- 检查了所有 iPhone 型号的键盘,除 iPad 外,它工作正常
我试过这段代码
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]];
我得到了这个输出ScreenShot。这是我在 iPad 中打开键盘时得到的确切布局。那么我哪里出错了?所有教程都显示在 iPhone 中,它似乎也适用于 iPad,但不适用于我的键盘。