【发布时间】:2014-07-13 17:40:19
【问题描述】:
我正在使用情节提要并添加了一个页面视图控制器,现在我想对其进行配置以使用我自己的自定义类。为此,我选择了在 Identity Inspector 下的 Custom Class 中指示使用 UIPageViewController 的页面视图控制器。我设置了我自己的 WinkPageViewController,但我得到了“碰撞”的声音,并且再次取消选择 + 选择视图控制器显示该属性已重置为之前的值。
我不确定代码的哪些部分是相关的,所以我暂时将界面留在这里,但如果还有其他相关内容,请告诉我。
@interface WinkPageViewController : UIViewController <UIPageViewControllerDelegate>
@property (nonatomic, strong) UIPageViewController* pageViewController;
@property (nonatomic, strong) WinkPageModelController* modelController;
//// Sent when a gesture-initiated transition begins.
//- (void)pageViewController:(UIPageViewController *)pageViewController willTransitionToViewControllers:(NSArray *)pendingViewControllers NS_AVAILABLE_IOS(6_0);
//
//// Sent when a gesture-initiated transition ends. The 'finished' parameter indicates whether the animation finished, while the 'completed' parameter indicates whether the transition completed or bailed out (if the user let go early).
//- (void)pageViewController:(UIPageViewController *)pageViewController didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray *)previousViewControllers transitionCompleted:(BOOL)completed;
//
//// Delegate may specify a different spine location for after the interface orientation change. Only sent for transition style 'UIPageViewControllerTransitionStylePageCurl'.
//// Delegate may set new view controllers or update double-sided state within this method's implementation as well.
//- (UIPageViewControllerSpineLocation)pageViewController:(UIPageViewController *)pageViewController spineLocationForInterfaceOrientation:(UIInterfaceOrientation)orientation;
//
//- (NSUInteger)pageViewControllerSupportedInterfaceOrientations:(UIPageViewController *)pageViewController NS_AVAILABLE_IOS(7_0);
//- (UIInterfaceOrientation)pageViewControllerPreferredInterfaceOrientationForPresentation:(UIPageViewController *)pageViewController NS_AVAILABLE_IOS(7_0);
- (WinkOAuthProfileProviderIdentifier)profileProviderPreference;
- (void)saveProfileProviderPreference:(WinkOAuthProfileProviderIdentifier)preference;
- (NSURL*)profileURLWithProviderIdentifier:(WinkOAuthProfileProviderIdentifier)provider error:(NSError**)error;
- (void)saveProfile:(WinkProfile*)profile error:(NSError**)error;
- (WinkProfileData*)loadProfileWithProviderIdentifier:(WinkOAuthProfileProviderIdentifier)provider error:(NSError**)error;
- (void)didReceiveProfile:(WinkProfile*)profile;
@end
我知道我没有实现 UIPageViewControllerDelegate 可选方法(恰好是所有这些方法),但我之前已经在 swift 中完成了这个并且它有效。我该怎么办?
【问题讨论】:
-
我假设你已经在其他地方实现了
UIPageViewControllerDataSource,对吧? -
是的。
WinkPageModelController实现了该协议。这就是我发布的代码中的modelController属性 -
顺便说一句,我的场景中还有两个视图控制器(不是页面视图控制器),它们都有自定义类。这么多。
标签: ios objective-c xcode storyboard