如何在客户键盘上加载.xib视图UIInputViewController

时间:2017-06-24 13:40:10

标签: ios objective-c xib custom-keyboard

我遇到了一个关于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];

xib的图像。 enter image description here 键盘上{while}打开扩展名enter image description here

上的输出

0 个答案:

没有答案