UIPicker View Rotate Support - xcode

I have a universal iOS 6 Application that supports both landscape and portrait orientations.
I have a view that consists of a UIPickerView at the bottom and a label near the top.
On an iPad or iPad Mini there's enough space for the UIPickerView to rotate. However the UIPickerView consumes the entire screen area on an iPhone (both 4 inch and 3.5 inch screens).
I'm sure it doesn't help I have a Tab Bar at the bottom.
Is there anyway I could EITHER shorten/shrink my UIPickerView or force portrait-only in this view?

You can force portrait-only through a combination of -[UIViewController supportedInterfaceRotations] and -[UIViewController shouldAutorotate]. (This is slightly different in iOS 5 and lower, where you have to use -[UIViewController shouldAutorotateToInterfaceOrientation:].

Related

How to fix scrollable content size ambiguity in xcode 11 using auto layout beta 7 UIKIT

When using Auto Layout, I am unable to set up a simple UIScrollView in my view controller in Xcode 11 beta 7. I know that I must constrain the scroll view to the edges, and then set the scroll view width and height equal to the width and height of the entire view that contains the scroll view. However, I am not getting the option to set equal widths and heights when I attempt to do so.
When I do the right-click-drag from the scroll view to the entire main view, I get the following options:
Leading Space to Safe Area
Top Space to Safe Area
Trailing Space to Safe Area
Bottom Space to Safe Area
Center Horizontally in Safe Area
Center Vertically in Safe Area
In other videos, there is an "Equal Widths" and "Equal Heights" option that I don't seem to have.
Am I doing something wrong, or did Apple change the way scroll views work in Xcode 11?
I'm using beta 7 currently
I was finally able to successfully add a UIScrollView using storyboards in Xcode Version 11.0 (11A420a) after much trial and error.
You can add the scroll view directly to the root UIView of the VC or, if you needed to, add it to another UIView under the root view as needed by your UI Design. Constrain the UIScrollView parents normally for whatever your needs are.
Here is the key : when you add the UIScrollView to the storyboard, click on the Size Inspector with the UIScrollView selected. You have to UNCHECK the box that says "Content Layout Guides".
If you do this you can set the scroll view's contraints normally (I did 0-0-0-0 to superview). Then I added a UIView to the scrollview and set it's constraints to 0-0-0-0 and a height of 900 (which is what I wanted).
This will give you constraint errors in red when you set them. They will be fixed by setting the width of the UIView equal to the width of the UIScrollView.
Set the UIView width equal to the width of the UIScrollView view by Ctrl-right clicking on the UIView, dragging to the UIScrollView, and selecting the "Equal Widths" option. This should get rid of your constraint errors.
You actually can then go back to the UISCrollView Size Inspector and check the "Content Layout Guides" checkbox, no constraint errors will appear.
Disable the content layout guides in scrollview properties.
Hope it helps.. :)

Xcode 10 View Controller Scene Positioning Problem

I have inserted a label into my View Controller and centred it to the middle. When I run the app on the simulator for iPhone 6 the label is not centred.
I have tried adding constraints to the label. When running the app in the iPhone 6 simulator hides the label completely. What am i doing wrong?
Make the background color of the label to a darker shade.
If there are any red constraints, try to eliminate them
The best method to centre a label is to select the label from the structure hierarchy, click on to the Align button in the bottom, select Horizontally and Vertically in Container to be at 0 value

Text starting at wrong position in textview in Xcode 6

There's no code involved at the moment, only storyboard or xib files as far as the textview is concerned. This is what I get when running the app on my iPhone 5s or via the simulator.
I'm using auto layout and size classes with the option any width-any height. An imageview at the top, then a label, then the textview.
Here's a picture of the screen. As you can see, it looks as if the text is starting behind the label, but the textview's y is after the label and the constraints seem all correct according to Xcode 6. It works fine on iPad.
Any idea of what I'm doing wrong?
I've found a way round it: textview should have no scrolling enabled and should be put in a scrollview instead, which will do the actual scrolling. Need to add constraints to both.

Black Bar at top of SplitViewcontrollers Navigationcontroller?

This is only for landscape mode on the iPad because in portrait mode it was sorted by adding popovercontroller.popoverLayoutMargins = UIEdgeInsetsMake(1,0,0,0);
There is a splitVC with a detailVC and navVC added which controls a rootVC.
This also does not happen in iOS 6 only iOS 7?
Are you sure that you do not have a UINavigationController inside a UIViewController (besides the Split View controller)?
It also seems like you're using a custom background image. Make sure your background image is not 44pt tall (which is fine on iOS 6). On iOS 7, it should be 64pt (128px on a Retina) to correctly extend into the status bar area.
Eventually the only thing that worked here was hiding the status bar all together. This was done in the plist file by adding :

Round Rect Button

So when I use the iphone 5 simulator for xcode my round react buttons are all in the right position. But when I use the iphone 4 simulator the buttons move around and get deformed. how can I get this to not happen? I want the buttons to stay in the same place no matter what version of phone i use. So an example would be, I position 5 buttons verticaly on the left side of the screen. When I use the iphone 5 simulator the buttons are in the right place. I use the iphone 4 simulator and the buttons are all smooshed. Thanks

Resources