I faced some kind of bug, i have a UIButton with no title & placeholder and with Image in it, created in storyboard. When i set my project target to IOS 15.0 everything looks right, but when i change it to 14.0, by button has Image and placeholder "Button", how can i get rid of this placeholder ? Storyboard] app screenshot]
In button properties in storyboard there is no placeholder set.
Related
Xcode 9 beta 6,iOS 11
I downloaded a Instagram logo which was a .png file,and I created a UIButton and UIImageView in the Main.storyboard.The logo image was set as follows:
And I set the TintColor of the UIButton and the UIImageView is white,but when I run the project, the color of the image for UIImageView is still black,while white for UIButton.
imageView setting:
Why it is black for imageView and white for button with the same
setting of the image? Thanks.
Additional remarks:
When I used code to add the subview imageView,it worked well.Really werid!
Problem still exists in Xcode 9.4.1
Setting desired color for tintColor in User Defined Runtime Attributes help me to fix this problem:
I set global tintColor in AppDelegate.
I was not getting proper tint color on iOS 13 Xcode 11 in dark mode. However, same image tint color appeared correct when set fora bar button.
I resolved it by setting Render As property of the image as Template Image in images.xcassets. I neither had to remove UIImageView in storyboard nor add again or adding user defined property.
You can do that by changing the image Global tint color from the storyboard:
Apparently there is a problem with story board where if the image view is added before adding the image in xcassets as template, the Tint Color does not take effect (if set in the storyboard). I was able to reproduce the problem. I tried the following and it worked.
Remove the UIImageView
Create a new UIImageView
Set the image and TintColor
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.
I have a UIButton of type:System and title:Plain added to my view with IB.
The title of the UIButton is blank in IB.
The title is set programmatically with [.button setTitle:NSLocalizedString(#"title", #"") forState:UIControlStateNormal];
On IOS 9 the button has the standard blink animation when tapped.
On IOS 8 the button doesn't have the standard blink animation when tapped.
If I set a title for the button's default state in IB then the standard blink animation starts working on IOS 8.
The trouble is I have a lot of buttons like this and adding garbage titles for all of them in IB will be confusing for translators.
Is there another way to fix this for IOS 8?
I have a UIButton in a nib file(.xib) which uses the Attributed Title from IB, but does not reflected when runs on device.
My configuration for button is as follow:
but not reflected.
One reason could be you have again set the UIButton title by programmatically. If you set your button title from IB, and again set it from code. In runtime it take title from code.
I have a text box which has a popover. Also placed a button on top of the text box to make it clickable so that when button is clicked the popover is opened and any item selected will be shown in the text box. This is working fine in iOS7 but in iOS 6 i am able to select the item in popover but the button is hiding the text. Tried setting colour of button but didn't work.
Please help.
If you set the type of the button to "Custom", and you don't set an Image or a Background Image, the button will be invisible on versions prior to iOS7 too.
If you create the button programmatically:
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
If you change it on your interface:
Instead of using button, you can open popover by UITextbox itself. Just place the button's IBAction code in textbox's IBAction with EditDidBegin Event.
Set UIbutton's buttontyoe to UIButtonTypeCustom for iOS 6