iOS8 Size-Classes and Popover Views - ipad

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.

Related

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.

Xcode 7 Beta 5 - All subviews missing from Storyboard

I've recently switched up to Xcode 7 Beta 5 and I've been trying to solve the UITableView issue that I know lots have experienced. One solution I found was to disable size classes, however, once I did that I wanted to roll back my solution to a commit I just performed before that.
After I discarded all the changes I was presented with my view controllers and none of their subviews visible in them. In the hierarchy to the left they are listed but are 'greyed out'. Can anyone help with solving this?
Screenshot for reference:
It's worthwhile noting that when the app runs all of the ui elements are still present as expected - just in storyboard they are not displaying.
Try checking it in different layout such as any width compact height.
Grey out generally means that your view are active on a particular layout.
You can see the changes when you tap in the bottom wAny hAny and select different sizes...

Default size classes seem to only work for iPad (XCode 6)

I am trying to wrap my head around the new size classes in iOS8 and XCode6. I am attempting to create a nib, without a storyboard, and do something really simple--center a UIView on the screen.
Starting with a nib in the default size: w:Regular h:Regular, I place a 200x200 UIView onto the parent view and center it, then add contraints to pin it. In my preview pane, the UIView only shows up on the iPad view.
I need for this view to show up on iPads in lanscape and iPhones in portrait. I suppose some day i will understand why Apple thinks this is so much easier, but at the moment I'm bewildered.
When I switch my design view to any of the iPhone supported modes, the UIView disappears.
Even when I unpin the UIView and move it around in the design view, it never shows up in the iPhone view. In other words, I've tried everything to get this view to appear on an iPhone and nothing works.
Here is my UIView and settings:
Obviously there is something I'm missing, but I'm getting really frustrated trying to figure it out. Can anyone offer a clue? Thanks!
It's because you defined your view only for the size classes Regular & Regular. For them to show up on the iPhone you will have to configure the view also for the appropriate size classes, which in case of the iPhone is Regular & Compact where (<height> & <width>).
UPDATE:
The views generally only show up in the size classes for which they are configured. You currently have Regular & Regular selected, this can be seen from your screenshot. This means you defined it only for the devices with size classes Regular & Regular, which is the iPad in both orientations.
You need to add the views also in the size class that you are targeting, which are the size classes of the iPhone.

Xcode 6 view controller showing blank screen with autolayout

I'm trying to use view controller that I decided to use auto layout for. Before I used auto layout, the view showed normally like how I intended it to during runtime. But I decided to switch to auto layout (because after all, bigger iPhones are coming), and even after setting it up, getting no issues at all, and seeing that the app scaled well to the iPhone size in IB; I still have a blank screen. To prove it, here are pictures:
So why is this happening? I added the constraints in the square view, and it gracefully scaled to the iPhone view in Interface Builder. If you also look at the sidebar, the alerts for auto layout errors are not present. And IB is rendering everything. But why is the simulator blank?
And yes, I connected all the elements to be code correctly. I verified. And yes, I have code that puts text in a label. Here it is, in the 'viewDidLoad()' method:
override func viewDidLoad() {
super.viewDidLoad()
self.titleLabel.text = "Hello, World!"
}
And I will reemphasise: the app worked before I did auto layout. For this build, I deleted all the elements, relocated them, reconnected them, and added tweaked the view with auto layout unit IB rendered it correctly. But I'm getting different results here.
Please help me. Oh, and sorry for the massive images, I can't figure out how to shrink them.
EDIT: I've gone through and used the view debugger, and tried to capture the view hierarchy to look for clipping or occlusion. Funny enough, the view debugger shows the content properly, and there wasn't any clipping or occlusion that I saw. When I tried to show frames in the simulator though, it didn't show anything. I'm starting to think that this is a simulator bug. Currently, I'm using Xcode 6 beta 6.
I recreated the issue by adding a collection view to a standard view controller and this seems to be the problem:
Having Xcode add suggested constraints gives you this, which causes the view to not show up.
It is aligning the view's left and right to the layout guides (which doesn't seem to be right)
You will have to manually add spacing constraints to your view.
This is what you want:
Try turning on the assistant editor and use Preview while tweaking your constraints.
(source: mattknott.com)
Do your Editing in "wAny hAny For All Layouts Base values" mode. then you will not see blank screen while testing on different devices.
Mode selection can be one from bottom bar.
Good Luck

Default width of iOS 7 views

When I add a UIViewController to a storyboard in the latest xCode its view is defaults to 600x600 in size. This means centred items appear off to the right and the view extends off the bottom of the screen. Why is this?
Many thanks,
Ben
in Xcode 6 the interface builder works with AutoLayout. So you need to set constraints to your views to be in the right place. See here how thats works: Click me
But you also can disable the size class to work in the exact ViewController like this:
If you turn size classes off you see an window like this:
Just select the size class you want (iPhone for example) and you can work like you want it.
But I would recommend to work with AutoLayout due to the fact that there are a lot of different device types (iPhone 4(S), iPhone 5(S), iPad).

Resources