したがって、この SO question Hereに従って、2 つの新しいファイル セットを作成しました。
JCScrollViewController.m
JCScrollViewController.xib
JCKeyboard.xib
では、.mファイルのアウトレットが接続されJCScrollViewController.xib
たスクロールビューだけがあり、ビューアウトレットはビューに接続されています。scrollView
はJCScrollViewController.m
に準拠していUIScrollViewDelegate
ます。
私のアプリデリゲートでは、これを行います:
JCScrollViewController *viewController = [[JCScrollViewController alloc] init];
[window addSubview:viewController.view];
でJCScrollViewController.m
私はこれを行い-viewDidLoad
ます:
//load your JCKeyboard.xib into a UIView object
NSArray *nibParts = [[NSBundle mainBundle] loadNibNamed:@"JCKeyboard"
owner:nil
options:nil];
//first object is the view
UIView *keyboard = [nibParts objectAtIndex:0];
//add keyboard to scrollView
[scrollView addSubview:keyboard];
//set content size to same dimensions as TallView.xib
scrollView.contentSize = CGSizeMake(320, 600);
アプリを起動すると、次のエラーが表示されます。
this class is not key value coding-compliant for the key view.
これは何が原因でしょうか?
ありがとう