Issue with autoresizing in iOS - ios

I have an xib file with the image like this:
When I run it, it seems to downsize to this:
Width:320 Height:370 is the values I have given. There is a navigation bar above and a tab bar below.
Should the image show normally? it seems to be resized.. not sure why...
How do I avoid the shrinking?
Need some guidance.. Thanks...
*EDIT1 *
Huge apologies.. I am using iPhone(Retina 3.5 inch). that is why it is appearing on the middle. How do i ensure that it remains at the bottom for iphone(Retina 4 inch), iPhone (Retina 3.5 inch) and iPhone?
*EDIT2 *
in iphone 5, it looks like this:
How to avoid this?

please add bottom bar as tabbar in xib file ...

Open your xib and select your view then Uncheck the "Use AutoLayout" property from
File Inspector(Option+Command+1)

Select the image in the xib editor and set the mode to "top".

You need to set autoresizingmask of your view and imageview to UIViewAutoresizingFlexibleTopMargin if you want they stay bottom all the time.
And you need to remove UIViewAutoresizingFlexibleHeight.
You can do it with code or in interfacebuilder.

Related

Autolayout on preview and simulator looks different

Autolayout for landscape mode isn't working.
Here's what I see in storyboard (preview):
https://i.snag.gy/KZENBG.jpg
And here's simulator:
https://i.snag.gy/4EPsH8.jpg
As you can see, toolbar is disappearing to somewhere off the screen. I've tried both Top Space to Superview = Standart value and Top Space to Top Layout Guide = Standart value in toolbar's contraints, but got no result.
P.S. In the portrait mode everything works good.
First of all change device in preview and set it to iPhone 5 and then check looking perfect or not.If not then try to set from Size inspector from Utility area.
If this doesn't work then try this.
Delete Derived data of your project.Then run again.
Derived Data located at
~/Library/Developer/Xcode/DerivedData/(your app data)

Navigation bar not occupying entire screen

Im trying to create a UINavigationBar using storyboard but the UINavigationBar is not occupying the entire screen.
Following is the screen shot of my storyboard.
In storyboard, it appears to occupy full screen width but in my device, the width is not full. How can I sort this out?
select your viewController and go to XCode Menu - > Editor -> select Navigation Controller ,
for example
you get the output of
it works fine for any layout patterns
firstly you have to disable size classes and auto layout in the file inspecter for your view after then set your navigation bar property like as shown in screenshot. It will be applicable for all the devices.
1- Select your element.
2- Click triangle button at bottom right.
3- Click Add Missing Constraints
use autoresizing selecting your NavigationBar:-

Autoresizing issue in interface builder

I have set autoresizing property for a search bar in xib(for iPad) as shown:
Now:
i think i should set some property in mainView of interface builder, but dont know, which property, if you have any suggestions, please share it.
if i remove both the middle one and right line then i get something like this:
Just remove right red line from XIB autoresizing View as following image shows:--
Or try removing autolayout
DONE
PORTRAIT MODE
LANDSCAPE MODE

Xcode - Button looks good in storyboard but not on emulator

When I work with buttons in the storyboard they look good, like this:
But when i run the app they turn out like this:
Do you guys know why?
Here are som settings:
Thanks!
You might have put image in Image attribute of inspector.
Put that image in Background attribute of inspector.
top one in your attribute inspector Type, change that to Custom from Rounded.
By the way, our iOS has simulator not emulator. In android sdk we call it emulator ;)
check the view content mode in the attribute inspector it's in the fourth tab on your right colum. content mode can be scale to fill, aspect fit and a bunch of other possibilities. This will affect how it is presented. Check also in the fifth tab how your button autosizing is set.

UIView Retina 4 doesn't work

I'm trying to update my application to catter for iPhone 5 4 inch retina screen.
I'm using custom nibs for different screen size versions as I want to show something different and make use of bigger screen.
I've created another nib and I'm properly calling it from initWithNib method.
This is what I'm getting:
It's only a start, I've setted background color of the View to black, but as you can see simiulator isn't scalling the view up. I don't know why. In IB there is 4 Retina View type selected. The dimensions are ok. I've checked everything I though of and still the same result.
Any ideas?
UPDATE
Here are my settings:
In IB do you have anything set in the Simulated Metrics panel for top bar or bottom bar as these will cause the view to shrink accordingly?
Ok... I was just setting the frame in my app delegate and it was causing this issue.
I need to look at my code more :)

Resources