带图像的滚动视图不滚动

时间:2010-11-02 16:49:04

标签: iphone uiscrollview scroll

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

感谢。

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];

3 个答案:

答案 0 :(得分:4)

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

boxImage.userInteractionEnabled = YES;

应该有帮助。

答案 1 :(得分:1)

滚动视图大小必须小于滚动查看内容的大小。

答案 2 :(得分:0)

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

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

相关问题