【发布时间】:2011-06-18 06:02:17
【问题描述】:
我想知道是否有人可以解释一下为什么 UIScrollView 委托中的任何方法都没有被触发。
设置场景。我有一个 UIViewController 被推送到堆栈上。在这个视图中,我制作了 5 个自定义选项卡。在每次点击时,我都有一个功能,其中包含来自 UIViewController/xib 组合的 5 个视图(每个选项卡一个)。
ExercisePhotoView *exercisePhotoView = [[ExercisePhotoView alloc] initWithNibName:@"ExercisePhotoView" bundle:nil];
exercisePhotoView.exercise = self.exercise;
[self.photoView addSubview:exercisePhotoView.view];
[exercisePhotoView release];
在其中一个加载的视图中,我有一个滚动视图,其中包含一些图像(上面的代码块是上述视图)。 self.exercise 是一个 NSManagedObject。图像被很好地加载到滚动视图控制器中并且分页工作。然而,任何 ScrollView 的委托方法都不起作用,例如
- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)theScrollView
我已经在我的头文件中包含了对委托的引用。
@interface ExercisePhotoView : UIViewController <UIScrollViewDelegate> {
IBOutlet UIScrollView *scrollView;
IBOutlet UIPageControl *pageControl;
Exercise *exercise;
NSMutableArray *exerciseImageList;
}
我是否遗漏了什么或做错了什么。我无法在 ExercisePhotoView 类上触发任何委托方法。
提前谢谢你。
【问题讨论】:
标签: iphone ios uiviewcontroller uiscrollview uiscrollviewdelegate