Content inset not working Storyboard Xcode8 - ios

Recently I have updated Xcode 7.3 to 8. While opening the project the project settings also have been updated for new Xcode.
Now the insets given for a button image for positioning the image inside button frame is not working as in previous Xcode(7.3) version.
The image insets are given through storyboard. Image was used here to have large clickable area for button than the button image display area. Is there any other options to get it through storyboard.

In Xcode 8 the button content/title/image insets have moved to the Size Inspector tab:
Which seems quite logical by the way! 😀

I had this same problem and solved it with image insets and the Horizontal/Vertical Alignment controls. My problem was that I had the wrong alignment controls selected. Once I changed it my insets worked properly for what I was trying to accomplish.
I created a button with an image and the I wanted to shrink the image down to not fill up the entire button So I set the image to the UIButton image property in storyboard and then set the image insets to my liking
But it did not center my image with the inset of 5 on each side. The image would look like this and that was not what I wanted
If you change the horizontal/vertical alignment controls I was able to the button image to my desired look I wanted

tl;dr: Set the "Style" to "Default"
(if you're on Xcode 13, iOS 15 or later)
Long answer:
I know the very title of this question references Xcode 8 - but this comes up in a Google search and I had issues in Xcode 13 (iOS 15) where the content/title/image insets are not reflected in the storyboard or at runtime. This was due to the new button system, and the solution was to set the button's "Style" to "Default" (it was "Plain").

Its weird,but it actually works until you add collectionview or tableview in your Viewcontroller. Try setting the inset without having the scrollview or tableview in your view controller

There is a weird behavior when having a UITableView or UIScrollView on the scene (as mentioned by #RAHUL JOSHI). Sample
Solution: Just ignore the previsualization bug as on runtime this will work normally.

Content inset for button is working perfect in xcode 8 beta.
See below screenshot that i have taken from xcode8 beta.

Related

how to set image as background in launch.storybord + xamarin.forms

in recent release of xamarin launch screen can be designed from storyboard instead of old approach where we were adding all splash screen images according to wise.
https://developer.xamarin.com/guides/ios/application_fundamentals/working_with_images/launch-screens/
from this link get to know how can set launchscreen using storyboard.
so my question is how can i set image as background to storyboard dont want background colour.
i need image as background on which i can put logo image and label.
so is it possible?if yes then how.
please help.
You need to set top,bottom,leading,trailing constraints on the imageView.
Select Constraint edit mode ,and click twice to show the point on side which ca be dragged to set the constraint.
Modify the constraint value to 0(in Property menu).
Do the same work on the four constraints.
Refer to Auto Layout with the Xamarin Designer for iOS

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)

Storyboard preview issue after converting to Swift 3/Xcode 8

Something strange happened to my project after I upgraded to Xcode 8 and converted the project to Swift 3.
Most interesting thing is that layout shows fine in the simulator but in the Preview everything is shifted to the right. Center of all devices appears to be almost at the right edge. For example I drag a label to the storyboard select Align Horizontally and add a constraint to the top... in preview it shows up for all devices shifted to the right instead of in the middle but in the simulator label is in the middle, exactly where it is supposed to be.
Also, if I create a new ViewController is would work just fine in preview and simulator... Anybody knows what can cause this issue?
In Interface Builder, select the view controller and then choose "Update Frames" from the "Resolve Auto-Layout Issues" popover menu that is in the lower right corner of the Interface Builder canvas. The issue is that in Xcode 8, the size of the previewed scenes has changed. If you tell it to "Update Frames", the various subviews should be adjusted to reflect the new "simulated size" for the scene's top level view (assuming all of your constraints are properly defined).
Leaving Xcode and re-starting worked for me to get the correct view per device in Storyboard again.

Xcode swift UIView bottom bar does not display

I'm a beginner in iOs development but I'm a web wedeveloper.
I was trying some small things on Xcode and I face a problem without finding solution or usefull information on the web, take a look to my UiView below
which is quite large, and has a bottom bar with Done button, and and another bar with some button.
But when I'm running the simulator, I can't see this bottom bar guide, I do have a button on it, I have an action on it, the "Hidden" field is not selected.
Any idea why it's happenning (Using Xcode 6 beta 7)?
Set left and right border constraints to 0, and "center horizontally" constraint as well.

Toolbar not filling the whole width at iPad

I am reading (through O'Reilly Safari) the book Learning iPad Programming and there is a modal view with a toolbar and 2 buttons ("Cancel" and "Done") at the top.
My problem is that when I try to recreate that universal app, at the iPad simulator the toolbar doesn't use the whole window width:
There is a "flexible space" element between the buttons, but it seems not to affect the parent toolbar.
Can anybody please advise me how to stretch the toolbar and the textfield, maybe I need to set some property of it in Xcode 5?
UPDATE 2:
I've attached 2 new screenshots - don't see any "autoresizing" in Xcode 5:
I've submitted my question at Github too.
It Looks like your View doesn't resize to the complete width. I guess it does not have the Autoresizing Width attribute. You can set in in InterfaceBuilder of your xib in the size inspector.

Resources