2010-11-02 251 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