iphone - 创建协议(protocol)后访问 UIPageViewController 的委托(delegate)方法

标签 iphone ios objective-c

我正在使用 UIPageViewController 并且我已经制定了自己的协议(protocol),如下所示:

@protocol MyDataDelegate <NSObject, UIPageViewControllerDelegate>

- (void)recieveData:(NSString *)theData;

@end

如何将 UIPageViewController 的委托(delegate)设置为 self 以便我可以使用这些委托(delegate)方法?正常的代码是 self.delegate = self;但由于我已经做了另一个代表,它给了我一个警告 "Assigning to 'id<MyDataDelegate>' from incompatible type 'PageScrollViewController *const_strong'"我想将其设置为 self,以便我可以访问 UIPageViewController 的委托(delegate)方法

最佳答案

您的子类使 UIPageViewController 的委托(delegate)属性黯然失色。为您的委托(delegate)属性指定其他名称,例如:@property (nonatomic,weak) id myDelegate;

关于iphone - 创建协议(protocol)后访问 UIPageViewController 的委托(delegate)方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16301817/

相关文章:

iphone - 开发成本

ios - 分组的 UITableView - 复制设置应用 TableView

ios - 使用 pangesturerecognizer 创建边界以阻止对象进入状态栏下方?

ios - EKEvent 获取当前事件 iOS7

ios - iPad-物镜-C-键盘-一切都从左向右移动,而不是向下移动

iphone - 充分利用plist

iphone - 导航标题/项目在操作表 clickedButtonAtIndex 中切换选项卡栏项目时消失?

objective-c - 使用 NSNumberFormatter numberFromString 的精度错误

ios - 操作无法完成。 ( cocoa 错误 -1。) - PHPhotoLibrary

objective-c - 核心图如何格式化图例,请参见图片