UIPageViewControllerを使用するアプリケーションを開発しているので、左から右にスワイプしてページ(ViewControllers)をナビゲートできます。私の元の投稿以来、私はコードを書いている。しかし、私は3つのエラーを受けています。UIPageViewControllerデリゲート、データソース&インターフェイスエラー
エラー1:プロパティ「デリゲート」タイプのオブジェクトに見つからない「IntroPages」 エラー2:プロパティ「のdataSource」タイプのオブジェクトに見つからない「IntroPages」 エラー3:「IntroPages」の目に見える@interfaceを宣言
3つのエラーはすべて、viewDidLoadの最初のセクション({}の中にあるセクション)にあります。最初の2つはviewDidLoadの下にあるコード用で、3番目の5行は下にあります。
デリゲートとデータソースは.hファイルで参照されます。なぜ彼らは見つからないのですか? Wyは 'IntroPages'のための目に見える@interfaceはありませんか?
コードは以下のとおりです。
IntroPages.h
#import <UIKit/UIKit.h>
@interface IntroPages : UIViewController
<UIPageViewControllerDelegate, UIPageViewControllerDataSource>
@end
ページが多すぎるされていない場合、あなたはこのように、自分のIDの配列でビューコントローラの配列を作成することができ
#import "IntroPages.h"
@interface IntroPages()
@end
@implementation IntroPages
{
NSArray *myViewControllers;
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.delegate = self;
self.dataSource = self;
UIViewController *p1 = [self.storyboard
instantiateViewControllerWithIdentifier:@"Intro1ID"];
UIViewController *p2 = [self.storyboard
instantiateViewControllerWithIdentifier:@"Intro2ID"];
UIViewController *p3 = [self.storyboard
instantiateViewControllerWithIdentifier:@"Intro3ID"];
UIViewController *p4 = [self.storyboard
instantiateViewControllerWithIdentifier:@"Intro4ID"];
myViewControllers = @[p1,p2,p3,p4];
[self setViewControllers:@[p1]
direction:UIPageViewControllerNavigationDirectionForward
animated:NO completion:nil];
NSLog(@"loaded!");
}
@end
どのような問題に直面していますか。投稿コード。 –
私はどこにいるのかで投稿を編集しました。コードが含まれています。 – thejdah