2010-10-11 71 views
0

嘗試將不同來源拼接到任何形式的相干方法或概念失敗後,我再次轉向StackOverflow的學習人員。我的問題很具體,也許這就是爲什麼我很難找到適合的信息,或者我可能只是在搜索。無論哪種方式,在這裏。從UIScrollView中將UITableView縮放到全屏

我正在構建一個應用程序,該應用程序具有用UIViews填充的UIScrollView,而UIViews則填充了UITableViews。我有分頁和一切設置和正常工作。基本上,我試圖反映Safari的(移動)選項卡行爲的功能,或者(更接近我試圖實現的)Tweetdeck的主頁面。我無法發佈圖片,但如果你點擊下面的鏈接,你會明白我的意思。

http://www.redmondpie.com/wp-content/uploads/2009/07/TweetdeckIphone04.jpg

的原因UITableViews都在裏面UIViews是,這是我能想出使tableViews讓他們之間的空間,而不是被旁邊對方的唯一途徑。我嘗試設置tableViews的大小和scrollView的插入內容,但是tableviews總是以填充整個scrollView的方式結束。在任何情況下,這是一個單獨的問題,可能

當我點擊一個tableView/UIView裏面的scrollView我希望tableView/UIView放大和填充整個屏幕(減tabBar和navigationBar),然後我應該能夠通過按下導航欄上的後退按鈕將其縮小。

任何信息或在正確的方向微調非常感謝。

回答

1

我做我的應用程序類似的東西:

-(void)displayPage:(int)targetedPage { 
    ... 
    [UIView beginAnimations:@"MultiViewAnimate" context:nil]; 
    [UIView setAnimationDuration:0.3]; 

    //animate the frame 
    //targetedPage is the index (table view) that should be displayed 
    [(UITableView *)[tableViews objectAtIndex:targetedPage] setFrame:CGRectMake(0, 0, 320, 372)]; 
    [(UITableView *)[tableViews objectAtIndex:targetedPage] setUserInteractionEnabled:YES]; 
    ... 

    [UIView commitAnimations]; 
} 

-(void)displayMultiView:(id)sender { 
    ... 
    [UIView beginAnimations:@"MultiViewAnimate" context:nil]; 
    [UIView setAnimationDuration:0.3]; 

    //animate the frame 
    //targetedPage is the index (table view) that I was previously looking at full screen 
    [(UITableView *)[tableViews objectAtIndex:targetedPage] setFrame:CGRectMake(60, 70, 200, 232)]; 
    [(UITableView *)[tableViews objectAtIndex:targetedPage] setUserInteractionEnabled:NO]; 
    ... 

    [UIView commitAnimations]; 
} 

在這段代碼tableViews是所有UITableView s表示了滾動包含數組。

我正在做的比這更多,因爲我正在截取我的視圖並使用UIImageView作爲縮放視圖,然後將動畫返回到各自的UIWebView。該方法的一個優點是,我只需將UITapGestureRecognizer附加到UIImageView,而不必在關閉UITableView上關閉userInteraction。