简体   繁体   中英

Can't assign custom class to Page View Controller

I'm using storyboard and I added a Page View Controller, which now I want to configure to use my own custom class. For this, I select the page view controller which is indicating to use UIPageViewController in Custom Class under the Identity Inspector. I set my own, WinkPageViewController, but I get a "bump" sound and deselecting + selecting the view controller again shows the property has been reset to the previous value.

I'm not sure what parts of the code would be relevant, so I'll leave the interface here, for now, but please let me know if anything else is relevant for this.

@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

I know I'm not implemented the UIPageViewControllerDelegate optional methods (which happens to be all of them), but I have done this before in swift and it worked. What should I do?

A square is a rectangle, but a rectangle might not be a square

Page View Controller (from the Object library in a Storyboard) represents UIPageViewController .

View Controller (from the Object library in a Storyboard) represents UIViewController .

WinkPageViewController inherits from UIViewController and cannot represent the custom class of a Page View Controller object.


UIPageViewController Class Reference

https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIPageViewControllerClassReferenceClassRef/UIPageViewControllerClassReference.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM