Buttons are resizing in simulator? - ipad

Can someone tell me why these buttons are resizing themselves in the iPad simulator?
This is what they look like in the .xib builder
But when running the simulator they end up looking like this:
I have "unchecked" Autoresize subviews in both the VIEW, and each BUTTON. Still, they resize?

It seems like 2, 3, 4 & 7 button are not positioning perfectly. As it looking all buttons are same in size so replace these 4 button image with a good one (eg. 1) and run it again. Now observed the problem still there or not. If not solve then just delete these 4 buttons and try with complete new. If still it remain same then positioning the buttons programmatically with size. Hope it helps you.

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

iOS: autolayout for multiple button

In my app I have a view for 4 inch screens in this way:
And then I want to reduce the size of my buttons when the app is running on an iPhone with a 3.5 inch screen, so I set my layout in this way:
but finally I obtain a view in this way
In this way the size of my button are ok but they are not aligned, so in this situation, what's the way to have aligned buttons?
thanks
Hi as per your question i've created demo similar to the layout for which you need the controls need to set. I've added images for single control and made video this using multiple controls to set the layout which you retrying to set.
link: https://www.youtube.com/watch?v=Nl2iMF0yKW8&list=PLXCowKcXAVgrxHKLWTa4HxNPrSmTj3D-_
Hope this will solve your issue.
I may not comment till I 50 posts, so here is the link. I had like the same problem some days ago. Just put all those in a parent view and center the parent view.
Link to my question/answer:
Top constraint won't get less with auto-layout

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.

ios - simulator looks different from the layout on the storyboard screen

I am having a strange situation. I created a very simple screen with some buttons on the storyboard, then when I ran the emulator (is it correct to say simulator or emulator?) it got the spacing wrong for one of the buttons.
I am adding a screenshot. The emulator is to the right of the storyboard screen.
Any idea why this may happen?
I thought it was a problem with the button. And it might have been. But when I took out two lower buttons, I got something even weirder as shown on this screenshot:
Thanks!
It looks like you are using Autolayout, and all your buttons except Investment has a Top constraint while Investment has a Bottom constraint, causing Investment's distance to bottom to stay the same when the screen grows taller.
Click on Investment button, click [Editor -> Pin -> Top space to Superview] in the top menu.
Click Investment button again. Click the second tab from the right in the right panel (the one where you can set frame). Look for a Top Space to Superview constraint, right click and delete. If there isn't one, then XCode did its job. Try running simulator again.
Edit: I just want to say that XCode has a habit of adding Top constraints for you when the view you just dragged into the xib is in the upper half of its container, and Bottom constraints when it's in the bottom half. I know XCode is trying to help but it drives me crazy sometimes.
It looks like you're using a 3.5" simulator and laying out for a 4" device, so the view will be resized.
If you're using autoresize masks, are some of the autoresize masks on your buttons incorrect? You probably want them all to stick to the top of the screen. Check to make sure the autosizing for each of your buttons matches this image. (You'll need to click the "ruler" icon to see these settings.)
I assume that you're using the XCode4 which provides NSAutoLayout as default. When you place an object to the storyboard NSAutolayout automatically creates constrains which layouts the object on the screen automatically for different devices(iPhone4,iPhone5) or orientations(portrait/landscape). Please check NSAutolayout class and constrains. if you want you can remove the NSAutolayout and your objects will be displayed on the simulator normal but in that case you have to manually adjust your objects for different orientations and screens
Hope helps.

Storyboard layout not correct on iPad 2

I am trying to lay out objects on a Storyboard using the interface builder yet when I run the app on an iPad2, the layout is being messed up and objects are not appearing where they should. All the objects are there but they are being moved horizontally and not the same number of pixels! For instance, I have two ImageViews overlayed on one another (one is 100x100 and one is 75x75 centred within) but when the app is run on the iPad, they are both being moved horizontally across the screen by different distances!
I'd like to add screenshots but unfortunately I can't for privacy reasons.
I know it's vague but does anyone have any ideas on where to start looking to fix this?
Thanks.
I had this problem too when I was first making an iPad app.
Try fiddling with some of the 'struts & springs' of the interface elements in the storyboard. To do this, select some of the interface elements, then on the right panel go to the size inspector and try some things with the 'Autosizing' rectangle.
Hope it helps!

Resources