I have been trying to understand why my view controllers do not return to the correct position after the in-call status bar is turned off. When present all the content shifts down (some uiviews inside cells even shift incorrectly with respect to the cell but thats another issue), but also when the call is finished and the status bar closes, the content moves up but is still shifted down by maybe 20 pixels so it does not move back up by the same amount as it was shifted down. any ideas on how can this be avoided or fixed?
Related
My rootViewController is a UITabbarController and contains UINavigationControllers.
In order to restrict rotation, since iOS6, on some but not all views, I have subclassed both of the these controllers to respect the shouldAutorotate response of their topmost or visible view.
This all works just perfectly... most of the time.
In one case, starting from a view (UITableviewController) that does not allow rotation.
I push a view that does allow autorotate, rotate to landscape then back to portrait.
Then when I pop the view, all appears well.
But now if I rotate the device, the status bar alone rotates, leaving a blank space at the top and covering a part of the left side of the current view. The current view does not rotate (as it should not). Only the status bar rotates, back and forth. The view remains responsive, receives touches and works as normal, doesn't resize or respond to rotation in any way (as it should not).
This behavior continues until I kill and restart the app. Once it happens I have found no other way to make it stop. On restart all works properly again and will work properly for an indeterminate duration. I can sit there pushing, popping, rotating back and forth to my hearts content with no issues.
I have never been able to recreate this in simulator.
It happens for no apparent reason, I cannot make it happen. I'd say 85% of the time it works properly. I thought I had it fixed many times when it did not occur for days or even weeks. Then, out of the blue it happens again.
I cannot find a post in any forums which describe this behavior, so I am not finding even a place to start to debug. How could the status bar swing from top to side and the view does not resize or rotate or respond in any way. If I knew how to make that happen, I would have a place to start.
I experienced the same problem when adding a subclassed UIWindow (in my case, a status bar overlay).
The solution was to set the rootViewController of this new UIWindow to a subclassed UIViewController that had -(BOOL)shouldAutorotate implemented. This prevented the status bar from rotating when it wasn't supposed to.
This is a really strange issue I have not been able to narrow down.
The left side of a split view screen goes black under certain conditions. These are,
The first, and the most odd, is that the screen must initially be loaded in portrait mode. If its loaded in landscape I can't reproduce this issue.
in portrait mode (where the left side of the split view is hidden) you hit a button to display the popover of the left view, then dismiss it.
go to the next screen in the navigation.
change to landscape
go back to the split view screen
and poof, the left side of the split view is black. Like the view was never loaded.
initially my thoughts were that this was a memory leak issue, having to do with the popover not being de-allocated correctly.
However, the fact the app must start in portrait mode really confuses me. Even if i start in landscape, then move to portrait for step 1 and go through the process, it all works fine. Even through multiple iterations of these steps, it never triggers the blank screen.
I would assume I should post code but I'm so lost as to what the issue could be, I don't know where to begin.
When a phone call occurs, my app moves down, and the bottom of the app is cut off slightly. Is there anyway to shrink or resize that whole view when a call occurs.
Preferably through interface builder.
Indeed, your application window does shrink its subview. For example, if you have a status bar so the frame of your root view is (0,20,320,460), then if the in-call status bar is on, then the frame becomes (0,40,320,440).
Then why does the bottom of your app seem to be cut off? It's simply because the root view autoresizes its content in that way. For example, its autoresizingMask property says it has a fixed top margin and a fixed content height. So,
If you want to 'squeeze' the view, try fixing both top and bottom margins and having flexible content heights.
If you want the in-call status bar to look as if it goes over your app, fix the content heights and the bottom margin, and have a flexible top margin.
If you have a fixed top margin and a fixed content height, then your app will seem to slide down.
Once again, I'm almost entirely sure this is something dumb that I'm doing, but I've been banging my head against this one for hours & am getting nowhere.
I'm trying to restructure the view hierarchy of my app. I need to be able to detect user interface orientation changes globally in order to correctly rotate a "Loading" view displayed when the app is downloading content. (device orientation changes seem to fire at different times, causing the view that needs to respond to these events to rotate sporadically).
The app previously added a UINavigationController's view to the main window. I modified the hierarchy to add the view of a UIViewController subclass to the main window, and added the view of the UINavigationController to the subclass's view. The UIViewController subclass manages the display & rotation of the "Loading" subview, and I was expecting the rest of the app to continue behaving normally, as inserting one extra empty view into the hierarchy didn't feel like I was changing too much.
My initial problem was the positioning of the UINavigationController - it was 20 pixels too low, resulting in a gap between the status bar and the navigation bar, and cutting off the bottom 20 pixels of the tab bar. I was able to adjust this by setting the frame property of the UINavigationController's view to the bounds property of the UIViewController's view, which corrected the position.
However, now I'm stuck with a 20-pixel-high dark "overlay" on top of my navigation bar. If I were to guess, I'd say it was black with 50% opacity. Touch events on this bar don't work (e.g. if I try to tap the "Back" button through the overlay, nothing happens). The fact that the height is equal to that of the status bar hasn't escaped me, but I'm at a total loss as to what could be causing it.
I hate feeling this stupid, so if anyone has any insight into this problem, you'd really make my day. Thanks in advance!
OK, a few things pop out from your post.
My initial problem was the positioning of the
UINavigationController - it was 20
pixels too low
This makes me believe it is related to your new problem.
I was able to adjust this by setting
the frame property of the
UINavigationController's view to the
bounds property of the
UIViewController's view
This sounds like the view it was loaded onto was offset 20 pixels, and when you set it to the bounds, it repositioned it on the windows view space.
Touch events on this bar don't work
(e.g. if I try to tap the "Back"
button through the overlay, nothing
happens)
This is the big thing. If touch events aren't being sent to the view, then what that means is that the OS doesn't see a view where you are pressing (or rather the view you want it to), so that view doesn't get the message to do something.
From what you have said, I believe your problem is with your base view controller that you just added. Try redoing the frame on, making it conform to where you want. Then take out the code you put in to set the navigation controllers frame. The navigation controller should fit to the view you added too, and once you have that main view where it needs to be (20 pixels higher apparently), then everything should work.
I'm having a really hard time trying to animate the resizing of a UIWebView, and just don't know where else to go.
Here's what I want to accomplish: I have two views, one above the other (imagine two squares, one on the top of the other). The top view is a UIWebView, and the bottom one will be referred to as a general UIView (I'm not having any problems with the bottom one). I adjust the two views every time new content is loaded just fine. I also have a button that should hide the bottom view or show it, depending on its previous state.
That's where the problem kicks in. When the bottom view is hidden, pressing the button will enlarge its frame and reduce the UIWebView frame. That's fine. But if the bottom view is being shown and the button is pressed, the UIWebView frame will become larger, and there are some issues with it:
If the UIWebView is scrolled all the way to the bottom, it "jumps" up a little bit before coming down (becoming larger);
If the UIWebView is scrolled all the way to the top, it comes down as expected, as long as there is enough content to be scrolled behind the bottom view.
In general, what I've learned is that if the content yet behind the bottom view is LARGER than the amount of resizing happening, no jumping happens. Otherwise, it does.
I've done a lot of research, asked a previous question and so I'm assuming this is a consequence of lazy loading the UIWebView. This "jump" happens so that it is automatically resized (showing all the content, even if some of it is offscreen) and then moves down. Otherwise, it would be expanding and loading new content at the same time, requiring a lot more processor power.
I've experimented with frames, bounds and centers, and so far have got nowhere. Is my assumption correct? Is there no simple way to resize way to resize the UIWebView so that it goes only down (when becoming larger) and keeps the bottom scroll?
In theory, I think the right way would be to make the UIWebView larger to the top, keeping its current bottom position, and then animate bringing it down. This way, the top content would already be loaded. But I haven't had any success with it.
If anyone has any experience with this, please share. And thanks a lot.
If scrolled to the bottom of a tall enough web page, try animating the web view downwards without changing it's size, then change the web views height so that the top goes back to where it should be. You can temporarily fill the space left as the web view moves down with some sort of pattern.