简体   繁体   English

无法将自定义类分配给Page View Controller

[英]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. 为此,我选择了页面视图控制器,该控制器指示在Identity Inspector下的Custom Class中使用UIPageViewController。 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. 我设置了自己的WinkPageViewController,但出现“碰撞”声音,再次取消选择+选择视图控制器,表明该属性已重置为先前的值。

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. 我知道我没有实现UIPageViewControllerDelegate可选方法(恰好是所有这些方法),但是我之前已经迅速做到了这一点,并且有效。 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 . 页面视图控制器 (来自情节提要中的对象库)表示UIPageViewController

View Controller (from the Object library in a Storyboard) represents UIViewController . 视图控制器 (来自情节提要中的对象库)表示UIViewController

WinkPageViewController inherits from UIViewController and cannot represent the custom class of a Page View Controller object. WinkPageViewController继承自UIViewController ,不能表示Page View Controller对象的自定义类。


UIPageViewController Class Reference UIPageViewController类参考

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 IB - 无法为View Controller分配类 - IB - Can't assign class for a View Controller 无法在表视图控制器中为单元格设置自定义类 - Can't set custom class for cell in table view controller Interface Builder:无法将自定义类分配给表视图控制器 - Interface Builder : cannot assign custom class to table view controller 将视图控制器分配给自定义.xib - Assign a view controller to a custom .xib 如何将视图控制器指定为UINavigationController在自定义类中但不在AppDelegate中的第一个项目? - How to assign a view controller as UINavigationController's first item inside a custom class but not in AppDelegate? 无法将自定义类分配给Xcode 7中的视图 - Cannot assign a custom class to a view in Xcode 7 页面视图控制器:自定义页面滑块 - Page View Controller :custom page slider 模态加载视图控制器时,无法将文本分配给UILabel或传递NSString属性 - Can't assign text to UILabel or pass NSString property when modally loading a view controller 如何从自定义视图控制器类加载初始视图控制器 - How to load an Initial View Controller from Custom View controller class 在自定义类下拉菜单Xcode 8.3.2中找不到自定义控制器类 - Can't find custom controller class in custom class dropdown Xcode 8.3.2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM