如何使用标签栏以全屏模式打开 UIView?
这是我的问题。
- 我有一个 tabBar 应用程序。
- 在第一个选项卡中,我有一个表格。
- 单击表格时,它会显示一个模式 view.
- 从模态视图返回到第一个 视图 查看,我用
[selfpresentModalViewController:nwanimated:YES];
问题是,如果我在打开模式视图时单击选项卡栏,它将打开第二个视图,但第一个视图的表格不起作用,因为模式视图仍然打开,尽管它显示为关闭。
这是一种在全屏模式下打开模式视图并覆盖选项卡栏的方法吗?
或者还可以从另一个视图检查模态视图是否关闭?
编辑: 我尝试了所有这些代码:
nw = [[NewsViewController alloc] initWithNibName:@"NewsViewController" bundle:nil];
nw.modalInPopover = YES;
nw.wantsFullScreenLayout = YES;
nw.hidesBottomBarWhenPushed = YES;
nw.contentSizeForViewInPopover = CGSizeMake(320, 480);
nw.modalPresentationStyle = UIModalPresentationFullScreen;
nw.view.frame = [[UIScreen mainScreen] applicationFrame];
[nw.view setNeedsLayout];
但什么也没有!!!它不会进入全屏!
有什么想法吗?
谢谢,
阿尔贝托
this is my problem.
- I have a tabBar application.
- In first tab, i have a table.
- On click on table it shows a modal
view. - To go back from modal view to first
view, i use
[self presentModalViewController:nw animated:YES];
The problem is that if i click on the tabbar while is opened a modal view, it opens second view, but first view's table don't work because the modal view is still opened althoug it appear as closed.
It's a way to open modal view in fullscreen covering the tab bar?
Or also to check if modal view is closed or not from another view?
EDIT:
I tried with all of this code:
nw = [[NewsViewController alloc] initWithNibName:@"NewsViewController" bundle:nil];
nw.modalInPopover = YES;
nw.wantsFullScreenLayout = YES;
nw.hidesBottomBarWhenPushed = YES;
nw.contentSizeForViewInPopover = CGSizeMake(320, 480);
nw.modalPresentationStyle = UIModalPresentationFullScreen;
nw.view.frame = [[UIScreen mainScreen] applicationFrame];
[nw.view setNeedsLayout];
but nothing!!! It wan't go in fullscreen!!
Any idea please?
thanks,
alberto
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您呈现的视图是全屏,这应该会遮挡选项卡栏。也就是说,您可能需要以编程方式重新调整视图的大小,使其与 UIWindow 的大小相同。
您应该能够按照以下方式做一些事情
来实现这一目标。 (抱歉,我现在使用的是 Windows 盒子,所以我无法确认这一点。希望有人能在需要时提供任何调整。)
然后,您应该通过原始类中的委托方法关闭初始模式视图。 (请参阅 Apple 的 View 的“关闭模态视图控制器”部分iOS 控制器编程指南。)然后,原始类将处理模式视图。
If the view you're presenting is full screen, this should obscure the tab bar. That said, you might need to re-size the view programmatically so that it's the same size as the UIWindow.
You should be able to do something along the lines of...
...to achieve this. (Sorry, I'm on a Windows box at the moment, so I can't confirm this. Hopefully someone will provide any tweaks if required.)
You should then dismiss the initial modal view via a delegate method in the originating class. (See the "Dismissing a Modal View Controller" section of Apple's View Controller Programming Guide for iOS.) The originating class would then dispose of the modal view.
使用通知解决!
当选项卡更改时,我发送通知并关闭模式控制器。
在我看来,类收到通知并关闭控制器!
现在可以重新打开模态视图并更改选项卡!
这是一个解决方法,但有效!
阿尔贝托.
Resolved using notification!
When a tab change, i send a notification and close the modal controller.
In my view classes receive a notification and dismiss the controller!
Now it's possibile to reopen a modal view also changing tab!
This is a workaround but works!
alberto.