iOS 5 UINavigationBar removing subviews ( image subview) removes navigation bar

前端 未结 2 1931
故里飘歌
故里飘歌 2020-12-31 15:13

In my application that works fine on iOS 4 navigationBar dissappeared starting iOS 5. Here is what I figured caused issue: I was removing subviews in RootViewController view

相关标签:
2条回答
  • 2020-12-31 15:41

    You could make your added views subclasses of their respective UIKit classes and check against those specific subclasses. Really though, to have the clearest, most readable code, you should subclass the navigation controller and navigation bar to allow for a custom image and label to be drawn such that you could simply set the background image and foreground label to nil. It would take a little time to put together, but the end result would be much more extendable.

    0 讨论(0)
  • 2020-12-31 15:52

    setTag for those image and uilabel then removing it from code above did the trick.

    for(UIView* view in self.navigationController.navigationBar.subviews)
    {
       if(view.tag == 9 || view.tag == 99)
       {
          [view removeFromSuperview];
       }
    }
    
    0 讨论(0)
提交回复
热议问题