从 UIScrollView 内部将 UITableView 缩放到全屏

发布于 2024-09-27 14:09:03 字数 806 浏览 1 评论 0原文

由于未能尝试将不同来源拼凑成任何形式的连贯方法或概念,我再次向 StackOverflow 的博学之士求助。我的问题非常具体,也许这就是为什么我很难找到合适的信息,或者也许我只是不擅长搜索。不管怎样,就这样吧。

我正在构建一个应用程序,其中有一个 UIScrollView,其中填充了 UIViews,而 UIViews 又填充了 UITableViews。我已经进行了寻呼,一切都已设置并正常工作。基本上,我试图反映 Safari 的(移动)选项卡行为的功能,或者(甚至更接近我想要实现的)Tweetdeck 的主页。我无法发布图片,但如果您点击下面的链接,您就会明白我的意思。

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

UITableViews 位于 UIViews 内部的原因是,这是我能想到的使 tableViews 之间有空间而不是彼此相邻的唯一方法。我尝试设置tableViews的大小和scrollView的插入,等等,但tableviews总是最终填充整个scrollView。无论如何,这是一个单独的问题,可能

当我单击滚动视图内的 tableView/UIView 时,我希望该 tableView/UIView 放大并填充整个屏幕(减去 tabBar 和 navigationBar),然后我应该能够按导航栏上的后退按钮将其缩小。

任何信息或正确方向的推动都将受到高度赞赏。

Having failed in trying to puzzle together different sources to any form of coherent approach or concept I turn, once again to the learned people of StackOverflow. My problem is quite specific and maybe that's why I'm having trouble finding information that fits or maybe I just suck at searching. Either way, here goes.

I am building an app which has a UIScrollView populated with UIViews which in turn are populated with UITableViews. I have paging and everything set up and working properly. Basically, I am trying to mirror the functionality of Safari's (mobile) tab behaviour, or (even closer to what I'm trying to achieve) Tweetdeck's main page. I couldn't post an image but if you click on the link below you'll see what I mean.

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

The reason for the UITableViews are inside UIViews is that this was the only way I could figure out to make the tableViews have a space between them, instead of being right next to each other. I tried setting the size of the tableViews and the inset of the scrollView, among many things but the tableviews always ended up filling the entire scrollView. In any case, that is a separate issue, possibly

As I click on a tableView/UIView inside the scrollView I want that tableView/UIView to scale up and fill the entire screen (minus tabBar and navigationBar), and then I should be able to scale it back down by pressing the back button on the navigationBar.

Any information or nudges in the right direction is greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

大海や 2024-10-04 14:09:03

我在我的应用程序中做了类似的事情:

-(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 的数组。

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

I am doing something similar in my app:

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

In this code tableViews is an array of all the UITableViews that the scrollView contains.

I am doing a little more than this because I am taking a screenshot of my view and using a UIImageView for the scaled view and then animating back out to the respective UIWebView. One advantage to that approach is that I can just attach a UITapGestureRecognizer to the UIImageView and not have to mess with turning off userInteraction on the UITableView.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文