开发者

controlling better a viewcontroller

controlling better a viewcontroller

As shown in the image, I have a view 1 in the buttom containing cutom buttons, just to move from some views like tabbar, and in the first "tab" I have some buttons also, wich should push some views.

My problem is that when I add the naviguation controller and I push a view, I get all the view moving, including the buttom view 1. I just want it to move only for the upper views.

I tired to add the naviguation controller to the first upper view, but still not working.

Any 开发者_JAVA百科help please ?


UINavigationController (and indeed, the whole view controller architecture) doesn't support swapping out just some subviews. It works with UITabBarController because the tab bar controller contains the navigation controller. You really don't have that option.

Two options that might help are:

  1. Add separate instances of your "view 1" to both "view 2" and "view 3".

  2. Abandon UINavigationController and manage the transition from "view 2" to "view 3" yourself. Animating the transition isn't difficult, but straying from the recommended view controller architecture makes this a bit of an advanced topic.


If those are two separate UIViewControllers You can try to remove the button view1 and allocate new one on the next view.

[self.view1 removeFromSuperview];

if it is done as two UIViews in one class you can do the same, but without allocating the new button, just:

[self.view3 bringSubviewToFront:view1];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜