UIPageViewController를 사용하는 응용 프로그램을 개발하므로 왼쪽에서 오른쪽으로 스 와이프하여 페이지 (ViewControllers)를 탐색 할 수 있습니다. 내 원래 게시물 이후, 나는 코드를 작성했습니다. 하지만 세 가지 오류가 나타납니다.UIPageViewController 대리자, 데이터 소스 및 인터페이스 오류
오류 1 : 유형의 개체에없는 속성 '대표는' 'IntroPages'는 오류 2 : 부동산의 'IntroPages' 오류 3 종류의 객체를 찾을 수 없습니다 '데이터 소스는': 'IntroPages'에 대한 눈에 띄는 @interface 선언하지
세 가지 오류는 모두 viewDidLoad의 첫 번째 섹션 ({} 괄호 안에있는 섹션)에 있습니다. 처음 두 코드는 viewDidLoad 바로 밑의 코드이고 세 번째 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
그래서 우연한 문제는 무엇입니까 ... 그리고 무엇을 시도 했나요? ...? 게시물 ur 코드. –
나는 내가있는 곳에 게시물을 편집했다. 코드가 포함되어 있습니다. – thejdah