Swift navigation bar animation issue - swift

I am at a loss with what is potentially a simple fix.
I have a basic ViewController with a UINavigationController, and a UISearchBar embedded.
Basic view layout
When I PUSH a new UIViewController onto the Nav - I get a brief animation issue where a black background appears, and also the cancel button doesn't disappear.
Animation glitch
It's only brief, but annoying enough.
When I return back using the back button, the search bar reverts to white, and then switches to red.
Back display issue
I wondered if I had configured something wrong, so I created a fresh project and left everything with the defaults. Yet I get the same issue.
Stripped back and the same issue
I'm using xCode 9.3 - with swift 4.1
Any ideas?

Check the extendedLayout settings of your view controllers (these can be set in code or in the storyboard editor). They need to be the same for both view controllers or you'll get this animation glitch.
In your case the problem might be the embedded search bar. It seems to be present only for one of the view controllers. You've got navigation bars with two different heights because of that. The framework doesn't respond well to that...

Related

Part of UIButton area not firing func touchesBegan

The Area shown below of a UIButton is not registering touchsBegun but registering when touchesEnded ( which is calling also touchsBegun). In addition, the highlight state is not working in this area (again it works only on release but less evident). I have checked also the debug hierarchy but do not see anything strange (I am new to x-code and swift :)). The other part is working as expected. The button to the right works as expected
hierarchy view 1
hierarchy view 2 with tree view
The problem is the navigation bar. Hiding it has solved the issue. It appears that the navigation bar takes a few pixels from the left of the screen to enable back navigation with a swipe; this was covering the button.

UINavigationItem out of sync when using popToRootViewController

I tap a tab bar item, which triggers poptoRootViewControllerAnimated. Most of the time it works as expected, but in some cases it pops to the correct view, but the navigation item is out of sync, "stuck" from the view i previously was at.
I've read about people having this problem with iPad's, when in landscape mode, but the solutions I've found don't work in this case. This is an iPhone app in portrait mode.
Happens with the simulator as well as on an actual iPhone. If someone has a suggestion or solution i'll be a very happy man!
Turns out that the different iOS versions handle this differently. This only occured on the older versions, so we had to rebuild the stack manually there.
do you get any message in the console like
nested push animation can result in
corrupted navigation bar
and
Finishing up a navigation transition
in an unexpected state. Navigation Bar
subview tree might get corrupted.
if yes take a look at these few answers...
but what they all basically mean is you are trying to pop from the navigation controller too early, probably before it is properly loaded...

UIToolbar disappears after dismissing Modal View Controller

I'm aware some of you may not be familiar with Monotouch, but this could certainly be a general iOS issue rather than a specific Monotouch issue.
I'm recreating an app with similar functionality to the default mail app:
This is a simple recreation of our app. It's a UIView which contains a UITableView and a UIToolbar. It's loaded from a XIB file (which contains accompanying view controller code). This view is a UITabController view (though I'm sure this shouldnt affect things?).
This has been pushed from a navigation Controller using
controller.PushViewController(inboxItem.Controller, true);
(where inboxItem is a custom object I've made, the Controller property being the inboxItem's view controller).
Pressing the right hand button on the toolbar presents a new modal view (compose new message) - which does its thing and no matter which way its dismissed, upon dismissal, the UIToolbar disappears. However, if I am to click on another tab then click back onto this tab, the Toolbar reappears. Is this a redraw issue?
Am I doing something wrong with the way I'm structuring my app? Or have I happened to stumble across some bizarre iOS/Monotouch bug? (I'm hoping it's for the former - so I can improve my iOS development).
I solved the problem. Basically, what was happening was when the ModalView was being presented and then dismissed, the toolBar was being moved down by 44 pixels each time.
In my example, the toolBar is placed above a UITabBar, so when the modal view was dismissed the toolbar was being moved out of view. I'm not sure why this is happening but I'll be sure to file appropriate bug reports.
One quick and (very) dirty way around this is to move the toolBar up 44 pixels when displaying the modalview, so that when it is dismissed, it will move it back down to the appropriate position.

Current UIView Questions iPhone SDK

I posted earlier but am running into similar problems again. Basically the way that my app is setup there is a top bar that is basically just a static image that has UIButtons placed on top of it. That is the Main View Controller and is persistent no matter what view is shown beneath it. I can't use a navigation controller because it is not possible to change the height and I need the bar to be significantly larger than a navbar. However my bar is functioning in much the same way. There is a "Home" Button, a "Back" Button and several destination buttons.
I understand how to switch views from say the home screen. My confusion comes with the back button. In order to press back the app is going to need to know what view is currently being displayed so that it can be removed from view and a new subview can be added. Ideally I would use the UINavigationController so that I can push and pop views which is really what I want to do here, however that is not possible because of the visual problem.
Does anybody know of a method that returns the current displayed view so I could do something like the following
[currentview.view removeFromSuperView];
[self.view insertSubview:experienceViewController.view atIndex:0]
You can use UINavigationController with the nav bar hidden. Put the nav controller inside a view that does have your jumbo toolbar and you'll have access to the push/pop behavior you're looking for.

How to present a modal view controller with fixed UIToolbar?

I am trying to set up a Modal View Controller, that that lies below a fixed toolbar. therefore the toolbar is supposed to stay on top while the modal view rolls in.
the Safari-App does that for example, when hitting the bookmarks-button. the toolbar stays, the buttons change..
I tried a couple of things like pushing the toolbar to the front and ended up not using the presentModalViewController method at all, and animating the new View manually into a subview instead. but that brought a couple of other issues along.
I'm not sure what you are saying, when you press add bookmark in safari, a new modal view shows with no tool bar. The navigation bar at the top is not a tool bar if that is what you mean. They are UIToolbarItem set into self.navigationItem.
All modal views I've seen are animated until they take up the whole of the screen. Those modal-like views that only scroll up to a certain point in some apps, are done by hand. Maybe you can cover those issues encountered when doing this by hand in another post?