I currently have an app with a square UIView where an image will be drawn. In Portrait view a UIToolBar exists at the bottom of the UIViewController.
It looks like this :
However, when changing into landscape mode,I'd like the view to stay a square on the left hand side, and the toolbar to be aligned vertically on the right hand side, and the icons stacked vertically. Is there a way to do this with Storyboards?
There is no way to do this in storyboard as standard UIToolBar does not support vertical layout. You will need to develop your own component or find something third-party.
Related
I have a UIToolBar underneath a navbar, and in this toolbar is a Bar Buttom Item which holds a UISegmentedControl. The problem is I can't add constraints to anything inside the toolbar. The UISegmentedControl pins itself to the left margin when I place it inside the toolbar/bar button item, but then I don't get any dashed blue line when I try to set it width to be the same from the margin on the right side. I see no options to center either, but I don't really want to center, I want to make the segmented control grow in width as the screen goes from iPhone4 to iPhone6+ (in portrait) so that its always some X-pts from the left and right margin. How can I go about doing this?
I have the width of the toolbar, which is 375 for a 4.7inch screen. I can also get the width of the segmented control for this size too, but I can't tell the correct width to make the margins on the left and right the same, I can only eyeball it.
You should add the UISegmentedControl as a direct subview to the UIToolbar (either via addSubview or directly in interface builder). While going the detour around UIBarButtonItem seems convenient here, it deprives you of the possibility to lay things out exactly as wanted, because UIToolbar will handle layout for you and you cannot override this.When you add the UISegmentedControl as a subview, you can add constraints as needed to make it fill the entire width.
Well I have a problem,
I'm doing the reverse for my iPad app, but I want my tabbar is exactly like this:
I'll put the volume controls, play and pause on the left and right side of the tabbar icons ....
how can I change the position of them?
For alligning the elements, you should take a look at this question:
Aligning UIToolBar items
I'm not sure how to add custom controls to a UIToolbar, but I'd expect you could do this by setting their frame to overlap the UIToolbar.
I have a view on an iPad that contains one UIWebView consuming most of the display and two buttons at the bottom. When I rotate left, the buttons end up on the right and I have a gap on the left not filled by the uiwebview.
What I would like is for the buttons to always be on the bottom and for the uiwebview to fill the remaining space. I have tried various options with autosizing in interface builder without success.
Is this possible with autosizing? It seems like a fairly simple scenario.
Set the button's autoresizingMask to UIViewAutoresizingFlexibleTopMargin and the web view's to UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight.
I setup in IB in portrait mode my main view (for iPad). I have a toolbar, a map view (x=0, y=44, w=768, h=774) and a footer view (x=0, y=818, w=768, h=186).
When I rotate the iPad, I want the map to stay on the left side and be resized vertically to fit the view (x=0, y=44, w=756, h=704) and put the footer view on the right side (x=0, y=818, w=768, h=186) and extend vertically too.
Anyway, the effect is exactly the same as the WeatherBug application. I don't know how they do that, but their view containing the information is rotating by 90 degrees with the UIScrollView and UIPageView, I have basically the same needs and really don't know how to make this. Do they have everything in the same xib? I'm so confused...
Please tell me if you know how to do/organize a such view!
Thank you...
If you want the map to stay against the left side and be able to resize vertically set its autoresizingMask as such: mapView.autoresizingMask = UIViewAutoresizingMaskFlexibleRightMargin | UIViewAutoresizingMaskFlexibleHeight;
I don't understand how you want to footerView to resize through (y=818 in landscape mode is out of the visible view).
You should read the UIView reference, specifically the part regarding autoresizing mask (link: http://developer.apple.com/iphone/library/documentation/uikit/reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instp/UIView/autoresizingMask )
I have an uitabbarcontroller which contains a couple uiViewControllers.
When i show one of those controllers i am hiding the tabbar. This view has a fullscreen uiimageView. The thing is i am seeing a white rectangle over where the tabbar is hidden.
I have tried resizing the views but the white rectangle is still there. Any ideas? Thanks
Fullscreen in the tabbar or for the entire viewport of the device? The rectangle is there because one of your views is not positioned correctly.
Validate that your UITabBarController and/or UIViewController is set to the correct size and the correct position on the screen.