ios - moreNavigationController is always nil in UITabBarController -


i'm trying customize title of more button in uitabbarcontroller i'm doing app in language. subclassed uitabbarcontroller able access tabbarcontroller property. unfortunately, it's nil wether put in viewdidload or viewdidappear(_). thoughts on how can edit it?

import uikit  class controllervc: uitabbarcontroller {  let uimanager = uimanager()  override func viewdidload() {     super.viewdidload() }  override func viewdidappear(_ animated: bool) {     if let tabbaritem = tabbarcontroller?.morenavigationcontroller.tabbaritem {         let deselectedimage = tabbaritem.image         let selectedimage = tabbaritem.selectedimage         tabbarcontroller!.morenavigationcontroller.tabbaritem = uitabbaritem(title: "بیشتر", image: deselectedimage, selectedimage: selectedimage)     } else {         uimanager.showactivityindicator(self)     } }  } 

the problem not morenavigationcontroller. problem tabbarcontroller. class uitabbarcontroller. tab bar controller's tabbarcontroller property nil.

just do:

let tabbaritem = morenavigationcontroller.tabbaritem let deselectedimage = tabbaritem.image let selectedimage = tabbaritem.selectedimage morenavigationcontroller.tabbaritem = uitabbaritem(title: "بیشتر", image: deselectedimage, selectedimage: selectedimage) 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -