UIViewController's view strange resizing behavior - ios

I've created a UIViewController with a UIView defined in the loadView method. When I presented the UIViewController's view size in the viewDidAppear: method changed to an enormous size. I will describe the solution in my answer.

First I've created an iPhone project. Then changed it to iPhone/iPad project. And in the MainWindow.xib file the iPhone settings remained. Because of this, the system increased my view's size to a big number. The solution was to create another XIB file named MainWindow~ipad.xib and set the window size properly.
If anybody has any question about this problem, please don't hesitate to ask it.

Related

Making XIB freeform view fit the Superview in Main.storyboard

subview
I'm currently stuck at making this freeform view follow AutoLayout/TraitVariation adjustments, so that it would look the same on every device. The view is contained in a separate .xib file. Somehow, pin and align tools are disabled. How can I refer to Main.storyboard. I wanna know if there's a way of making it follow superview (Main.storyboard) size using Interface builder.
I struggled with the same thing a couple of weeks ago and unfortunately, it seems there is no solution for that. I ended up with coping my XIB view into storyboard :(

How to programmatically create Launch Screen through Xcode (without Xib assistance)

I've been trying to figure out how to code up a launch screen that is not in Xib form. Reason being, I cannot for the life of me figure out how to do a decent job with Auto layout and constraint building. Please do not suggest that I pursue that course of action.
I was thinking of implementing a custom UIViewController (with a Xib to hold just a reference to the view controller instance) that I could set with a black background and 5 UILabel subviews. That Xib will be used as the "Launch Screen File". I have the necessary methods to make sure the labels always resize properly given different device sizes.
However, is that even the right way to go about it? I'm really trying to refrain from just creating a Xib and using that, or drafting up an image in Photoshop or something like that.

iOS Universal App Layout Issue

Please see the attached screenshots of the app running - as you can see there is an area at the bottom of the iPhone screen that is not used. The same area of the iPad detail is however. I know there must a bar somewhere I need to hide but I can't find anything amiss.
I have a UITabBar controller as my root VC, which has a tab that leads to the UISplitViewController. As far as I am aware, the UISplitViewController is being used in the standard form.
Can anybody point me in the right direction. I am not sure what information to post, so please ask if you need more info.
Thank you all for your help. In the end though, the solution was fairly simple! I checked the Extend Edges Under Top Bars and Under Bottom Bars options for the UISplitViewController and voila!]1
simple solution
open storyboard
select ur viewcontroller
change wAny hAny
preview ur viewcontroller in iPad/iPhone and all devices u needed
and rotate ur preview screen.
your How to solve this?
Review Debugging Tricks and Tips section of the Auto Layout Guide
Compare storyboard with actual results - does your storyboard contain the same issue (most lightly not).
Review the constraints you have set for the view in question.
Check your constraints for the size classes in view controller with the view in question.
Add an IBOutlet and instance variable for the bottom constraint of the view in question and set breakpoints. Implement any/all of the methods in the UIContentContainer protocol to see what is happening with the constraint and the current class size.
6.Implement - viewWillLayoutSubviews to see any frame changes.

iOS8 Size-Classes and Popover Views

I had an issue with Popover on an iPad app I was working on recently...going to just post it here as I think it may help others.
I'm using Xcode 6 and iOS 8 and Size Classes and the Popover View was built in a Storyboard.
As my iPad App is in Regular/Regular Size Class all the time I built the Popover view in R/R too.
No matter what I did with Constraints though, the popover just never looked right, it was a mess. So what was wrong??
After some time the penny dropped to check the Any/Any Size class constraints.... These were matching the erronous constraints that I was spitting out in the logs. So I designed the Popover view in the A/A size class and it worked fine!
This might seem obvious to some but I thought that because my App was R/R that my Popover constraints should be in R/R. However it looks like that if you are using a VC as a Popover that the constraints need to be made in the A/A Size Class.
For me, setting size to Any-Any then re-setting to Regular-Regualr fixed it.

iOS xib loaded at app start is not centered vertically

I have an iOS app that loads a xib file for the UI. When I first load the app the interface is about thirty pixels higher than it should be. In the app if I go down one screen and then come back to my main UI it's lined up how it should be.
Right now my view controller is subclassing UIViewController and in the app delegate it loads the nib using initWithNib:
Any ideas what I could do to get the first load to be properly centered on screen?
Within Interface Builder check the actual size of the view in question. I've found when you add and remove simulated elements on a view, such as the status bar, this can cause the height to be reduced but not always increased.
Thanks, that did it. The only thing that you have to watch is if you have the status bar or any other extra bars turned on in Interface Builder, it won't let you change the size of the view.
I tried to vote up your answer, Dave, but I'm too new to.

Resources