View goes under tab-bar - iOs7 Autolayout - ios

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;
}

Related

Equal Spacing from one another for Buttons in Xcode

I was wondering if anyone could help me...
I am trying to have perfect spacing between buttons for a soundboard app, but I cant seem to get it quite right even after using constraints etc.
I have attached an image to show you what I mean...
Thanks!
You Can Try Like This
i took 3 UIView on storyboard and give equal width of UIView than i put button on view and give button x centre by back view please see the attached screen shot of storyboard

Xcode autolayout guidelines do not appear

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:

Detail Text and Accessory Don't show [duplicate]

I'm trying to use Auto Layout for a custom Table View Cell in my app.
I can't seem to get the constraints quite right.
I layed the labels out in the custom Table View Cell, but the labels are still getting cut off. Any ideas?
Thanks! Will post anything else needed. Tried to show needed info in picture below:
Debugging in Xcode. Somehow what shows in Simulator looks different than in Xcode debug.
Here's the width of my TableView shown:
UPDATE:
The problem here was related to what user matt said in the accepted answer, but I wanted to make the Q&A a bit clearer now that I have it figured out for anyone else that comes across this.
In his initial comment, he mentioned the Xcode View debugging, which was great and I was able to dig into a little bit more. Its called the Assistant Editor: Device Preview, where you are able to see the layout and layers of what is onscreen to see if maybe you have labels overlapping or going offscreen based on the device it is running on. If you want to check multiple device sized, just hit the plus icon in the lower left hand corner of this picture.
This helped me find overlapping layers and sizing issues with the TableView. I was able to see how it looked on each device size.
What also helps here sometimes to use the Pin menu. Sometimes the labels can run off screen because it doesn't know where the constraints of the cell are based on the device size. So your label can run offscreen if the label is based off of a landscape layout but the device is an iPhone 5 and is in Portrait for example. This is the Pin menu:
Hope that makes sense and gives some more color to the problem. Let me know if you have any questions at all, thanks for the help everyone!
The problem is that you are using auto layout but you have not done anything about sizing the table view. The table view here is not your view controller's view; it is a subview. Your view controller's view is automatically sized to the size of the device / window, but its subviews are not automatically resized. So you are ending up with the table view much too wide for the device; the whole table is sticking off into space on the right side.
Use a trailing space from the right side of your labels to the edge of their superview, and set it to greater than instead of equals with a value of ~ 5
Review the constraints of your tableview with the View. Draw cell border, label border and tableview border with different colors to know which elements do not display correctly.
Ex:
#import <QuartzCore/QuartzCore.h>
...
cell.layer.border.width = 1;
cell.layer.border.color = [UIColor blackColor].CGColor;
The thing that worked for me to solve views being clipped was to uncheck "Constrain to margins" in Auto Layout.

Google AdMob Test Banner Not Showing

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.

UILabel in different position for 2 different screen sizes

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.

Resources