开发者

Overlaying a view overtop of a UITableView

开发者 https://www.devze.com 2023-01-12 20:46 出处:网络
So I am trying to 开发者_开发百科create a search that returns a bunch of results to a UITableView.When the user selects one of the cells, I want to overlay a detail view of that result in a nice, conc

So I am trying to 开发者_开发百科create a search that returns a bunch of results to a UITableView. When the user selects one of the cells, I want to overlay a detail view of that result in a nice, concise window. This view needs to have some text, buttons and a photo. I was looking into hacking an alertview but read that that is generally frowned upon. I also looked at the HeadsUpUI example in the iphone SDK, but that didn't do exactly what I wanted. Does anyone have any examples how to overlay a custom view on top of a tableView? Any help would be greatly appreciated...

I have also tried doing something like this with no luck:

CGRect newSize = CGRectMake(0.0f ,0.0f, 320.f, 400.0f);
UIView *newView = [[UIView alloc] initWithFrame:newSize];
[tableView addSubview:newView];
[tableView bringSubviewToFront:newView];
[newView release];

Also, if there is any way to blur out the rest of the view, that would be awesome. Any ideas? Thanks in advance!


why not just use a custom view presented as a modal view..With iPad there are a few new styles of presentation, (see UIViewController reference) and it blurs/disallows clicking in the background. Another iPad specific option would be a UIPopoverController.


Have yout thought about using two CALayers, a semi transparent white or black one that holds the blur effect and adding another for your custom data ?

You could use backgroundFilters for the backlayer to blur the underlying view.

Edit: Sorry, just read that the filters i'm thinking about are currently not supported for iOS ... but think about making the backlayer just semi transparent, might give a nice touch as well.


Thanks for the responses guys!

I actually decided to go with a dynamic popover that is created when the user clicks on a cell. That has the functionality I needed. I do think that tableView superview method would have worked if worse came to worse. Thanks again.

0

精彩评论

暂无评论...
验证码 换一张
取 消