SplitViewController - can one change the z-order of rootview and detailview? - ios4

In an iPad splitview app I am animating changes to the subview of the detailview by moving the views from left to right.
If the app starts in Landscape then when a view is animated to the left it goes underneath the rootview or left view. However if the iPad is rotated to Portrait and then back to Landscape then when a subview moves left it is over the top of the rootview.
What options do I have to either bring the rootview to the front or send the subviews of the detailview side backwards?

Sometimes if you ask a question you then work out the answer and I have. I did not think bringtofront would work but it does.
[_splitViewController.view bringSubviewToFront:[[_splitViewController.viewControllers objectAtIndex:0] view]];
(added once I could answer my own question)

Related

WKWebView appears above my navigationbar and tabbar

I have a viewcontroller that will include a WKWebView. My viewcontroller is inside both a navigationcontroller and tabbarcontroller. The WKWebView appears over both of these, hiding the tabs (on the bottom), and the title and back button (on the top), and they only appear when you scroll up or down. How do I fix this.
Found it. Changed the webview's scrollview backgroundColor.

Slide UIWebView over a ImageView (like safari)

I think the title says everything about my problem.
The ImageView is not in the UIWebView.
I want that the ImageView is pushed up by the WebView.
It's actually pretty simple. If you go into your storyboard (or nib) and choose the the webView and choose a color for it's background property, anytime you scroll above the view that background color would appear. So all you need to do is load an image for that background color.
In your viewDidLoad method, place this bit of code:
self.webView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:#"background.png"]];
and where it says background.png
just put the image name that you loaded into your project.
Hope this helps!

How to stop view resizing after unhiding the NavigationBar

I have a view with a UITabBar and the navigation bar is initially hidden. When I press the next tab I want the nav bar to be shown, but when I do this using setNavigationBarHidden: the view gets resized, and the tabbar is pushed out of the screen. How do I setup the views to where they won't get resized? Or get resized properly?
You will have to check your autoresizingMasks. You can adjust them programmatically or via IB. Autosizing is available in the Size Inspector on the right.
You will mostly have to change the tab bar's mask to fix it to bottom and left. Rest of the subviews will have to be handled as needed.
[self.navigationController setNavigationBarHidden:NO animated:NO];
or
after that
set urview frame to exactly for 44reduce(which is navingation bar height) from height.

ScrollView as subview does not respect frame boundaries

I have a UIScrollView (managed by a view controller) which I am using both full screen and as a subview. The full screen version works fine - the subview does not.
The subview is positioned so that it takes up about the bottom half of the screen, with a small - 20 pixels or so - margin at the bottom.
Initially it displays in the correct position but overwrites the bottom margin - even though the scrollview's frame is set to leave the margin.
When I scroll the view up by dragging it, the whole view moves upwards and obscures the top of the window. The frame stops moving when it hits the navigation bar at the top and starts scrolling like a normal scrollview. If I scroll it enough it eventually reveals the margin at the bottom of the screen.
I am at a loss to know what to do - I've tried every spring combination I can think of. I'm now looking at subview clipping.
Images below. The first shows the scrollview on initial page load, positioned correctly aside from lower margin overwrite. The scroll view has a white background.
The second image shows it scrolled up toward the top:
The third image shows it scrolled all the way up to the top - note that the lower margin has become visible.
I'm not 100% sure on this one, but worthy the shot: my guess is you're likely not setting the Bounds property correctly on your table.
To solve this issue, the easiest way would be to set myscrollview.clipsToBounds = true.
Something is definitely wrong here. I think what happens is that you are adding the same instance of scrollview as a subview on itself. So basically what you are left with, is one instance alone. Anything you add to the "subview", is basically added on the superview, since it is the same object.
For example, this is what I think you are doing in the view controller:
//...
private UIScrollView myScrollView;
public override void ViewDidLoad()
{
this.myScrollView = new UIScrollView();
this.View = this.myScrollView;
this.View.AddSubview(this.mySrcollView); // same instance
this.myScrollView.AddSubview(aUIButton); // "aUIButton" will be added in View also, since it is the same object
}
If this is the case, it is wrong. I suggest not changing the controller's view at all. If you want to have a controller that has a fullscreen UIScrollView, just create it and add it as a subview, making sure the AutoSizesSubviews property to true.
That's my understanding at least.

UISplitView Orientation problem

I use a TabBarController that contains 1 splitViewController and a standard viewController.
Everything works fine except when I rotate the device.
On the SplitViewController when I rotate the device from Portrait to Landscape and Landscape to Portrait everything is ok.
When I move to the tabBar that contains the viewController, when I rotate the device in any direction, everything is also ok.
But if the last orientation of the splitView controller was landscape and from the ViewController I rotate the device to Portrait, when I go back to the SplitView Tab, I lost the popover button..
Everything is displayed well if I rotate the device.
Any help?
This is a default problem for cases when you use UISplitViewController inside UITabBarController. The catch is, the device rotation notifications are not received by the UISplitViewController, if it's inactive. You can find more details here:
UISplitViewController in a TabBar ( UITabBarController )?

Resources