![]() | 1 aisk 2013-04-11 22:55:57 +08:00 楼主现在做ios了? |
![]() | 3 notedit OP 设置 scrollView的contentInset 可以解决这个问题 _scrollView.cOntentInset=UIEdgeInsetsMake(-20.0,0.0,0,0.0); 但是其他的没有navigationBar的就会上移20px |
![]() | 4 ewangke 2013-04-12 01:44:37 +08:00 @notedit 为啥要把带有navigationBar放到scrollview里?navigationController不是顶层容器么。 好奇楼主的设计 |
![]() | 8 alexrezit 2013-04-12 15:23:15 +08:00 via iPad @notedit 可以用 gesture recognizer 啊. 用 scroll view 很费内存吧. |
![]() | 9 ashchan 2013-04-12 15:59:28 +08:00 @notedit 多出的空白可能是由于 UINavigationBar 与 UIStatusBar 的默认关系引起的,但如果是这个原因的话应该是 20px 。你上面 10pt 和 20px 都提到了,不确定实际是哪一个。 |
![]() | 10 ewangke 2013-04-12 17:28:33 +08:00 |
![]() | 14 ewangke 2013-04-12 22:41:16 +08:00 @notedit @alexrezit 那个方法也可以考虑一下,简单的视图层次可以直接用superview相同的view,然后通过sendToBack/bringToFront和PanGestureRecognizer来实现(就是调整视图z顺序,然后对frame作动画) 有点类似于ViewDeck,只不过是全屏动画 https://github.com/Inferis/ViewDeck |
![]() | 15 notedit OP @ewangke 恩 这个方法不错 但考虑到这两个view里面的东西都还比较复杂 这两个view是一级页面 还会有二级视图等 暂时先用scrollView来实现了 |
![]() | 16 alexrezit 2013-04-13 09:49:09 +08:00 @notedit 就是直接用 navigation controller 然后检测到左右滑动手势的时候 push/pop. |
![]() | 17 qiang1012 2013-04-13 12:21:00 +08:00 之前混用TabBar和NavigationBar来模仿微信的push效果时遇到过类似的问题,楼主可以参考一下这个代码片段: // tabBarController.view.frame = (0, 0, 320, 480) UITabBarController *tabBarCOntroller= [[UITabBarController alloc] init]; // screenArea = (0, 20, 320, 460) CGRect screenArea = [[UIScreen mainScreen] applicationFrame]; // frame = (0, 0, 320, 460) CGRect frame = CGRectMake(0, 0, screenArea.size.width, screenArea.size.height); tabBarController.view.frame = frame; |
![]() | 18 tuoxie007 2013-04-13 14:23:28 +08:00 10pt,推测是statusbar的高度,so,是不是计算frame的时候和显示的时候,StatusBar的hidden不一致造成的? 小心ViewController的生命周期,viewDidLoad/viewWillApear/viewDidApear几个函数别用错了 |
![]() | 19 wezzard 2013-04-13 21:47:04 +08:00 楼主的需求是要做一个苹果未提供的container view controller。建议楼主看看官方关于customize container view controller的文档和网上一篇关于abusing UIViewController的文章,刚开始的时候我在这里摔了很多。 |
![]() | 20 notedit OP @wezzard 看了那篇abusing UIViewController 之前想过自己定制一个container view controller 但后来发现稍微修改下scrollview就可以满足我的需求,而自己实现container view controller也可能出现这样或者那样的问题. 事实上ios6.0里面pageViewController的一个选项可以满足我的需求, 但现在直接上ios6.0还稍微有点早. 谢谢你的建议 如果遇到什么问题会考虑用container view controller来实现. |