Swift UIButton edge insets - ios

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.

Related

Custom UISlider with pips ios

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.

UIButton with background image and title using auto layout

I currently face a problem when using UIButton. I have the background image designed by others like this:
background image
and I need to place the title for the button right after the white vertical bar in the background image. I tried to set left edge for the content but since I used auto layout, the frame will be different with different screen size(3.5", 4.7"...).
Is there a way to put text in the position related to background I want with auto layout.
Thanks
I personally would split the left side of the background image from the right side. This way you can have two UIButtons next to each other with horizontal space constraint of 0. The right side of the button will have to be placed inside a UIImageView so you can set the image as a property of the view rather that the button's background. You don't have to do this of course, but I prefer this solution as it is easier to manage across different screen sizes.
Here is a visual representation of what I explained above:
Separated Views for Single UIButton
You will then need to route the touch events of both buttons to run the same method or function, just so that both the right side and the left are clickable.
Note: I'm not sure exactly what you had in mind for the highlighting of the button, but this will have to be tested and adapted to get the desired effect.

Increase touch sensitivity of iPhone app programmatically

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.

Method to display UILabels and UIButtons Inline with each Other

In my app I have a "summary" paragraph that based on data an user actions in the app changes what it displays. The issue is it displays both regular text and clickable text (like a button) in the same sentence and line. The app will have a series of if else statements and based on the results of these the text that will be displayed is determined, but how do you make some of the text a button tied to an action and some of the text a plain label? Any and all help is appreciated!
In iOS 7, buttons look like blue text. I would suggest taking advantage of that fact.
I would use AutoLayout, and create your fields with constraints that put a very small amount of space between each label and button in your line of text/labels, with a vertical constraint on all of them that aligns their leading to match.

iOS - how to handle a case when there is a long text area in an app screen?

I am having a usability issue where in an app screen, there may be too much text and I have nowhere to put that text.
I am attaching a screen shot of my screen. You see how the text on top has more text, but there is no room to put that text. So the text just ends in ....
What is the common way people handle this kind of a situation?
Thanks!
Redesign your UI so you have more room for that text. Maybe your content will need to scroll. You will need to change that label so that the max number of lines is greater (or 0 for unlimited), and make the frame larger to accomodate more lines. You can also reduce the font size a little to decrease how much extra space you'll need to give it.
If you really wanted to, you could use a UITextView for that text, which allows the text to scroll easily (it's a UIScrollView subclass). Then you could just scroll that text, though it wouldn't be very good UI and you would still want it to be more than one line, because scrolling when only one line is visible at a time would make it hard to read.

Resources