uinavigationcontroller - Setting custom image for UINavigationBar or title: confusion during navigation -


I got enough information about how to use a custom image as a background for the UIInViewbar However, between the scenes, I have the following problem for which I have not received the answer.

I have a UITabBarViewController object as a root controller for which I initiate subviews (one per tab) to several UINAVACentolar objects each as their root controller in their UITableViewController object. It is possible to navigate a child controller from each table view, which displays more detailed information about the selected cell. Now I have the problem below:

I have set a custom background image in the navigation controller of each table view. This is done by overwriting the drawRect method of UINavigationBar. When a user goes down in the detail view of each table view, then the image should be replaced with the title of the detail view. I complete it using a global variable and I update it in every view in every scene and use the condition inside the overwrite direct method. So to describe it with some code:

In the app rep .h.file, I declare the external variable:

  extern BOOL displayImage;   

In App Rep. I file initialization of external variable .m file:

  BOOL displayImage = TRUE;   

is implemented for all view controllers like viewWillAppear method:

  // View where I want to show the image in the navigation bar - (zero ) ViewWillAppear: (BOOL) Animated (... self.navigationItem.title = Zero; // No Title Display Image = True; [Navigation Controller Navigationbar Set Sets Display]; ...} // View where I navigate Do not want to show the image in the bar - (zero) ViewViewAppear: (BOOL) Animated (... self.titl E = @ "info"; DisplayImage = FALSE; [Navigation Controller Setting Navigationbar Sets]; ...} // Overwritten Documentary UINavigationBar - (Zero) Direct: (CGRact) Racket {if (display image) {// code which draws the picture as DrynErrorctate} Otherwise {// code which only sets the black background}}   

When I expand the view view from the table view (the child controller of the table view ) And then navigate to the original view So this works very well. However, when I navigate through a wide view on another tab in the tab bar, the detail again shows the title and image of the scene (so far is good), but when I Then navigating back to the tab in which it views the view, the title of the detail is visible, but the image does not disappear (i.e. both title and image are shown in the navigation bar). It seems that the setNeedsDisplay method is not called in this state. During this, external variables are updated correctly

Can anyone tell me why I am wrong here?

Thank you

I was also in the same condition if I am having trouble with you If your image is not disappearing from the navigation bar while switching between different tabs then you need to create two images, one normal image is another black image.

Use black image instead of black color in the second part of the method of dragging in the category. And then you can also reset the variable in the view like the dceadium appears when switching from page rather than setting the variable on the next page. Your problem may be solved.

Comments