Strange behavior of custom back button in IOS - ios

I am trying to change default back button in IOS Swift to custom one. What I get is that
but should be that
How can it be fixed people?

In storyboard you can try using the "aspect fit" option or add aspect ratio to the button to make sure it has the correct scale according to the image.

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)

Content inset not working Storyboard Xcode8

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.

Is there a fast way (keyboard shortcut, etc...) to auto adjust button size to match image size using storyboards?

When I add an image to a button, I often have to look back at the image to get the widht and height, then back to interface builder and set the button width and height to match the image.
Is there a key shortcut or something that will set the width and height of the button automatically to match that of the image?
This question is regarding storyboards in xcode specifically.
Im aware that it can be done in code, not asking about that...
In Interface Builder use menu Editor/Size To Fit Content. Shortcut Cmd+=.
You need the button selected. If that option is greyed out, deselect, and reselect the button again.

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.

Resources