无法将自定义类分配给页面视图控制器

时间:2014-07-13 17:40:20

标签: ios objective-c xcode storyboard

我正在使用故事板,我添加了一个页面视图控制器,现在我想配置为使用我自己的自定义类。为此,我选择了页面视图控制器,它指示在Identity Inspector下的Custom Class中使用UIPageViewController。我设置了自己的WinkPageViewController,但是我得到了一个" bump"声音和取消选择+再次选择视图控制器显示属性已重置为先前的值。

我不确定代码的哪些部分是相关的,所以我现在将这个界面留在这里,但如果有任何其他相关信息,请告诉我。

@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中已经完成了这项工作。我该怎么办?

1 个答案:

答案 0 :(得分:0)

正方形是矩形,但矩形可能不是正方形

页面视图控制器(来自故事板中的对象库)代表UIPageViewController

View Controller (来自Storyboard中的Object库)代表UIViewController

WinkPageViewController继承自UIViewController,无法代表网页浏览控制器对象的自定义类。


UIPageViewController类参考

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