2010-11-02 233 views
0

我添加了一个图像滚动视图。但它不滚动... 请帮助解决问题。滚动视图与图像不滚动

谢谢。

boxImage = [[UIImageView alloc]initWithFrame:CGRectMake(0, 44, 320, 372)]; 
     boxImage.image = [UIImage imageNamed:@"chapter1box.png"]; 
     textScroll = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 175, 320, 755)]; 
     scrollTextImg = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, 775)]; 
     scrollTextImg.image = [UIImage imageNamed:@"chapter1narrationtext.png"]; 
     textScroll.backgroundColor = [UIColor clearColor]; 
     textScroll.scrollEnabled = YES; 
     textScroll.pagingEnabled = YES; 
     textScroll.directionalLockEnabled = YES; 
     textScroll.autoresizesSubviews = YES; 
     textScroll.contentSize = CGSizeMake(320, 775); 
     [self.view addSubview:boxImage]; 
     [boxImage addSubview:textScroll]; 
     [textScroll addSubview:scrollTextImg]; 

回答

0

在代码中我将scrollview添加到图像视图 我将它添加到self.view它现在的工作。

我们不能添加滚动视图到imageview ..?

1

滚动视图大小必须小于其滚动才能工作的内容大小。

+0

滚动视图大小为320 * 755,内容大小为320 * 775 ..是否存在代码..? – rockey 2010-11-02 16:54:27

4

UIImageView已将userInteractionEnabled属性设置为NO默认情况下。添加

boxImage.userInteractionEnabled = YES; 

应该有所帮助。

+0

感谢tia ...:] – rockey 2010-11-02 20:18:32