2011-02-25 65 views

回答

7

[眼下嵌套的滾動視圖是可能的,但在iOS版SDK以前到IOS4.0它不支持。請查看投票前的回答日期]

你必須閱讀Apple的UIWebview文檔,他們清楚地說,「重要的是:你不應該在UIS​​crollView對象中嵌入UIWebView或UITableView對象,如果你這樣做,可能會導致意外的行爲,因爲兩個對象的觸摸事件可能混淆並且處理錯誤。「

檢查此鏈接: - http://developer.apple.com/library/ios/#documentation/uikit/reference/UIWebView_Class/Reference/Reference.html

+1

由於iOS 3.0,這是不正確的,因爲嵌套的滾動視圖支持:http://developer.apple.com/library/ios/#documentation/WindowsViews/Conceptual/UIScrollView_pg/NestedScrollViews/NestedScrollViews html的 – HermioneGreen 2013-03-31 11:48:59

0

試試這個

  imageView = [[UIImageView alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 
scrollView = [[UIScrollView alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 
scrollView.autoresizesSubviews = YES; 
imageView.image = self.image; 
imageView.contentMode = UIViewContentModeScaleAspectFill; 

scrollView.delegate = self; 
scrollView.userInteractionEnabled = YES; 

scrollView.showsVerticalScrollIndicator = NO; 
scrollView.showsHorizontalScrollIndicator = NO; 
scrollView.backgroundColor = [UIColor blackColor]; 
scrollView.contentSize = [[UIScreen mainScreen] applicationFrame].size; 
scrollView.scrollsToTop = NO; 

[scrollView addSubview:imageView]; 
[self.view addSubview:scrollView]; 
3
我已經使用成功

UIWebViews中放置內的UIScrollView一會兒。

將滾動視圖的contentSize設置爲Web視圖的框架時應該小心。在我的情況下,幀的大小是相同的,contentSize的高度是幀的高度,寬度是幀的寬度的倍數。

嘗試也把METAS波紋管由web視圖

加載HTML和定身爲width:auto和可選溢出:隱藏。

那就是我的設置。

好運