我遇到了一个关于Objective c的关键问题,我在我的应用程序中添加了新的自定义键盘扩展,并加载了一个xib用于键盘视图。
但是当我打开键盘视图时它显示为空白 - 没有用户界面来形成XIB视图。
下面是我在UIInputViewController上加载xib的代码。
注意:使用xib视图添加扩展可以正常使用Swift - 这个问题仅在Objective-C上出现。
* KeyboardViewController.h
#import <UIKit/UIKit.h>
#import "NicBoard.h"
@interface KeyboardViewController : UIInputViewController
{
NicBoard *objNicBoard;
}
@end
KeyboardViewController.m
objNicBoard = [[NicBoard alloc] initWithFrame:CGRectMake(0, 0, 375, 215)];
objNicBoard = [[[NSBundle mainBundle] loadNibNamed:@"NicBoard" owner:self options:nil] objectAtIndex:0];
objNicBoard.translatesAutoresizingMaskIntoConstraints = NO;
objNicBoard.frame = CGRectMake(0, 0, 375, 215);
objNicBoard.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
[self.view addSubview:objNicBoard];
上的输出