【发布时间】:2013-12-02 12:55:14
【问题描述】:
我正在使用 PageViewController (https://www.cocoacontrols.com/controls/pageviewcontroller) 创建一个类似于 Wired 的杂志应用程序。
我在 CustomPagerViewController 上使用了这段代码来加载子视图:
- (IBAction)btn_index:(id)sender {
NSInteger currentPage = 3;
CGPoint offset = CGPointMake(currentPage * self.scrollView.frame.size.width, 0);
[self.scrollView setContentOffset:offset animated:YES];}
但是我需要 indexviewcontroller 上的几个按钮来加载正确的视图,当我使用相同的代码时,
在类型的对象上找不到属性“scrollView” 'Pag4_5ViewController *'
我已经搜索并尝试了几种方法,但都是徒劳的。
有人知道如何解决这个问题吗?
【问题讨论】:
-
“scrollView”是 Scrollview 的一个出口吗?你合成了吗?
-
@Abhijit Chaudhari 是的,scrollView 是“@property (nonatomic, strong) IBOutlet UIScrollView *scrollView;”我已经在 PagerViewController 上合成了它。实际上我已经使用了链接中的 PagerViewController.h 和 .m。
-
您在哪里定义 btn_index 操作?什么是“Pag4_5ViewController”。
-
@AbhijitChaudhari btn_index 是在我杂志的索引页 Pag4_5ViewController 中定义的。我需要几个按钮来“加载”正确的杂志页面而不会丢失滚动
-
您使用了来自PageViewController 的
PagerViewController.h和PagerViewController.m,但Pag4_5ViewController是什么?它是PagerViewController的子类?还是你重写?属性scroll在Pag4_5ViewController.h文件中声明?您的错误消息表示Pag4_5ViewController部分中未在@interface部分中声明的属性scroll和超类,或在超类中声明为private。
标签: ios uiscrollview parent-child uipageviewcontroller uipagecontrol