I am using too many number of images for buttons in my project. I found some issues while doing device test. App couldn't detecting the finger tapping sometimes. I need to increase the touch sensitivity programmatically to resolve this issue.
Like apple documentation says:
Make it easy for people to interact with content and controls by giving each interactive element ample spacing. Give tappable controls a hit target of about 44 x 44 points.
Make the button tappable size at least 44x44 pixels and it should work.
More informations here
https://developer.apple.com/library/ios/documentation/userexperience/conceptual/mobilehig/LayoutandAppearance.html
it's not possible, but you might have smaller action button which you could resize little more or you can have bigger transparent action button behind your smaller action button so you can get what you are looking for!
Add images to button like this -
here you can see the button border are larger that image size, so you can increase the touch area of button in this way.
For further image adjustment inside button, you can use image insets, which are also present in the same inspector in xib.
Related
I am trying to make a square button that is on the smaller side (30x30), and I want to include the amount of participants there are as the text, for some reason the button is cutting the title off on the left and ride sides (see picture) forcing me to either have a bigger button (not ideal) or have really small text (also not ideal). Is there a way to stop it from cutting off?
If you're trying to display one character in that 30*30 button, make the button size large, check screenshots for reference:
Change Button Style Plain into Default.
I am trying to modify a frame work and have encountered the following problem.
I have replaced one of the button image in the framework's xib file with my own one. The image itself is approximately 20Wx20H but I have set the button size to be 40Wx40H so that the clickable area is larger than the actual image.
When the VC is displayed, I see the image to be normal 20x20 aspect ratio. However, when I clicked on the button, it stretches to 40x20 and goes back to default upon release. I was wondering if there is a UIButton parameter that I can disable which was enabled by the framework somewhere? I have done a search on the buttons in the code and could not find anything relating to stretching the button. So I am guessing somewhere in IB there is my solution?
Below are the images for the button when touch down or not touched down.
Have you tried the following?
button.imageView.contentMode = UIViewContentModeScaleAspectFit;
Also are you using autolayout? If yes, what are the constraints?
Wondering if the above can be created using UISlider? If not, what other ways can this be accomplished?
You can set components of a UISlider, such as the currentThumbImage ( see: "Appearance of Sliders"1).
However, it is almost certainly easier to just re-implement a slider for this much customization. Simply use background UIImageView with the scale image, and then add a separate UIView (or UIImageView) for the arrow. Finally, attach a UIPanGestureRecognizer to the arrow view to allow a user translate the view vertically.
You can change a lot in the appearance of a UISlider like setting the thumb to a red arrow. You can also replace the background image with the inches ruler and with different rulers for the different device types and display sizes.
The one thing that I don't see is that you turn the slider to work vertically. I know them only working left to right.
If I'm right, your only chance is to have a ruler as background image and a view that contains the arrow and a label with the actual value. That whole view can be pawned and tapped using Gesture Listener.
I have a small image button which fits nicely in a certain area of my screen.
The image is a perfect size for viewing, but too small to tap.
Is there any way to make the button itself bigger (hence easier to tap), but make the image smaller, so it looks the right size?
You just use UIView as a touchView under the your small button.
Like this,
In this case, I put UIView under the small heart button. And, I implement tap action by UITapGesture.
So, using Objective C, I have a button to post to Twitter. I saved the image and placed it in my supporting files. I have the button looking like this: http://i.imgur.com/z8Pswxq.png in the storyboard.
But when I go to simulate the app with iOS simulator for it ends up looking like this: http://i.imgur.com/KW3oQYg.png
It seems to revert back to the size of the actual image no matter what. I can't seem to see a way to make it the size of the button. Unless is there a way to programmatically do it? Probably missing like, a checkbox somewhere.
I'm sorry about posting the links instead of using images: have like, 1 reputation.
Presumably you don't have any explicit constraints that are dictating the size of your button. The size of your button is being dictated by the button's intrinsic content size. In this case, that content size is the image size.
Either resize your image (e.g., programmatically or in your favorites graphics program), or install explicit constraints on the button that dictate the button's size. The constraints could be installed in IB by control-dragging with zero code.