【发布时间】:2012-07-16 01:01:22
【问题描述】:
有人知道如何将 uiscrollviews 对象放入 iCarousel 中吗? 我的意思是 IBOutlet 对象。
所以我尝试了这种方式:
- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index
{
UIScrollView *scroll = [UIScrollView alloc] initWithFrame...
scroll.contentSize =..
scroll.backgroundColor = ..
return scroll;
}
它可以工作,但我需要在轮播中放入一组 uiscrollviews(带有很多按钮),这是我用 IBuilder 制作的。
我也是这样弄的:
- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index
{
UIScrollView *scroll = [scrollArray objectAtIndex:index];
return scroll;
}
但是没有用。
【问题讨论】:
-
滚动视图是否与轮播在同一个 nib 文件中,还是每个都在它自己的 nib 中?您如何将滚动视图放入您的数组中 - 它是 IBoutletCollection 吗?
-
我创建了 3 个名为 scroll1、scroll2、scroll3 的 nib 文件,然后尝试这样做 - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)查看 { for (int i = 1; i
-
你应该使用 view = [[[NSBundle mainBundle] loadNibNamed:[titleArray objectAtIndex:i] owner:self options:nil] objectAtIndex:0];
-
数组是零索引的,你总是想要 nib 文件中的第一个项目,而不是匹配项目索引的那个。
-
对不起,尼克,它不起作用,我试过这样:view = [[[NSBundle mainBundle] loadNibNamed:[titleArray objectAtIndex:index] owner:self options:nil] objectAtIndex:0];