When you drag a new view into a view controller in the storyboard dotted blue guidelines are supposed to appear, which help to position the view and apply autolayout constraints.
Dotted blue guidelines
In my case these guides do not appear, no matter where I move the view. I must have done something to disable them, but i have no idea what. How can a get the guides back?
I'm using xcode 6.1.1 and autolayout is enabled ( the autolayout checkbox is checked and it seems to be working fine apart from this)
Thanks in advance for any advice you can give.
Make sure Editor > Canvas > Snap to Guides is enabled:
Related
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.
I Was create a UIViewControler in storyboard or XIB with autolayout.
When i add UITableView into the view controller it does not support all screens properly even not support to portrait/landscape screens too.
I Have attached a screen of my story board.
I am a Beginner for iOS , so i dont know hoe to set constraints.
Please Some one suggest a best tutorial to done this or provide a simple sample application.
FYI: I am using Xcode 6.1 and Objective-C
Thank you!
It sounds like you're having trouble with adding constraints to a UIViewController.
Here is a good primer on AutoLayout on Ray Wenderlich's site. It's a good way to get your feet wet with AutoLayout in Interface Builder.
Once you do that, consider reading this article about why to not use Interface Builder. I was finally convinced by this article to go the pure-code route, and I've enjoyed the results.
Anyway, for your particular example, here are some screen shots to add the constraints to your UITableView:
When you add the UITableView to your UIViewController, you probably lined it up so that all edges between it and its containing view matched up. In that case, when you click the "TIE Fighter" button (really called the "Pin" button), you should see the following:
At this point, you simply need to click the 4 "struts" to add those constraints to your UITableView. When you do that, they'll turn from light gray to red, as seen here:
At that point, simply click the "Add 4 Constraints" button to finish the job. Your UITableView should now be "pinned" to all 4 edges, causing it to resize automatically during rotation.
I'm having trouble displaying the Google AdMob test banner. I created a simple application as described in their docs https://developers.google.com/mobile-ads-sdk/docs/admob/ios/quick-start#manually_using_the_sdk_download. The only difference from that sample is that I'm using a UINavigationController
After looking around for a solution to another issue I found that by adding [self setEdgesForExtendedLayout:UIRectEdgeNone]; on my ViewController the banner appeared!
Has anyone run into this? What workarounds/fixes are there? Am I doing something wrong?
UPDATE 1
I created a sample project so you can see and test. I created Tags along the way to make it easy for you to navigate backwards as I made my changes. https://github.com/RoLYroLLs/GoogleAdMobTest.
One important thing to note is that as I made my changes, the ad doesn't appear when the label AND the textview were removed from the view (check tag v0.1.3. When I removed either one the ad did show up (check tags: v0.1.1 and v0.1.2).
In tag v0.1.5 I added [self setEdgesForExtendedLayout:UIRectEdgeNone] to make it work, but I don't like what it does to the tab bar and the navigation bar, they look darker or something.
Any feedback is welcome. Thanks!
UPDATE 2
The issue seems to be fixed when using Xcode 6.0.1. I guess it was a bug in Xcode 5.x.x?
You have to setup the proper auto layout constraints so when the view shifts behind the navigation bar, the banner adjusts itself.
The banner should have the following constraints:
leading space to superview
trailing space to superview
top space to top layout guide
The tableView should have the following constraints
vertical spacing to admob banner
leading space to superview
trailing space to superview
bottom space to bottom layout guide
You can set the constraints visually in the storyboard.
This looks like it was a bug in Xcode 5.x.x as I just upgraded to Xcode 6.0.1 and it works just fine.
This must be just another autolayout question. I did do all I can think of to find out what is wrong but nothing seems to right. Maybe I'm missing something or doing something really stupid.
I added an UIImageView to a ViewController, set the autolayout constraints of the ImageView in Xcode. To see the borders, i added an IBOutlet to viewcontroller and set border width of Image to 2.0 and border color to red. It works well in iOS 6, in both landscape and portrait mode. When i run the same in iOS 7, the bottom part of the view goes under tab bar.. heavy sigh. Im hoping this is something configurable in the UI, rather than making code change. I unchecked "Unchecked" Adjust scroll view insets for ViewController , also made sure that the bottom Space ( Vertical Space) of the ImageView is set to the top of Botton Layout Guide, as mentioned in apple ios migration guide. Im not sure what else to do and im not feeling lucky. Can someone please take a look ? I already spent few days on this and im not reaching anywhere. Here are few screen shots if it helps.
Thank you for your time.
Unfortunately stackoverflow wont let me add images unless i have brownie points :(
hopefully these links would work
iOS 7 screenshot
iOS 6 Screenshot
There is an option I believe called 'under bottom bars' uncheck this and it should work.
I found this code in another post and it resolved my issue.
- (UIRectEdge)edgesForExtendedLayout {
return [super edgesForExtendedLayout] ^ UIRectEdgeBottom;
}
I have a UILabel that i placed in the top left corner of the screen in the Storyboards. I disabled "Autolayout" and it works perfectly fine on the iPhone 5 screen. The problem comes when i try them on any of the smaller screens like the iPhone 4. The label is then placed on the bottom right corner. After this issue, i tried to programmatically 'fix' the position in the "viewDidLoad" method of the view controller, but it stills moves position and the problem continues.
Ive been scratching my head about this for a while!
Any help would be appreciated.
I would suggest that you turn autolayout back on. If you get the constraints right, this situation (two different screen sizes) is exactly the sort of thing autolayout is really good for. There's a very good reason why Apple migrated autolayout from OS X to iOS at exactly the moment the iPhone 5 screen appeared on the scene!
try to fix it at viewWillAppear
Go to the utilities panel, click the tab "Show size inspector", and change the autosizing. Then drag your component in your storyboard's view so that it stays in one of the "borders". If you do not need to support older iOS versions, I'd recommend you to figure the proper way with auto-layout though.