从UIScrollView内部将UITableView缩放到全屏

时间:2010-10-11 10:50:06

标签: iphone uitableview uiscrollview zoom scale

在尝试将不同来源与任何形式的连贯方法或概念拼凑在一起失败后,我再次转向StackOverflow的学识渊博的人。我的问题非常具体,也许这就是为什么我无法找到合适的信息或者我只是在搜索时感到厌烦。无论哪种方式,这里都是。

我正在构建一个app,其中有一个UIVcrollView,其中填充了UIViews,而UIViews又填充了UITableViews。我有分页,所有设置和正常工作。基本上,我试图反映Safari(移动)选项卡行为的功能,或者(甚至更接近我想要实现的)Tweetdeck的主页。我无法发布图片,但是如果点击下面的链接,你会看到我的意思。

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

UITableViews在UIViews中的原因是,这是我能想出的唯一方法,使tableViews之间有空格,而不是彼此相邻。我尝试设置tableViews的大小和scrollView的插图,但很多事情,但tableviews总是最终填满整个scrollView。无论如何,这是一个单独的问题,可能是

当我点击scrollView中的tableView / UIView时,我希望tableView / UIView向上扩展并填充整个屏幕(减去tabBar和navigationBar),然后我应该可以通过按下后面来缩小它导航栏上的按钮。

非常感谢任何正确方向的信息或推动。

1 个答案:

答案 0 :(得分: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是scrollView包含的所有UITableView的数组。

我正在做更多的事情,因为我正在截取我的观点并使用UIImageView作为缩放视图,然后动画回到相应的UIWebView。这种方法的一个优点是我可以将UITapGestureRecognizer附加到UIImageView,而不必在UITableView上关闭userInteraction。