How to set the textfield right-align in the Settings.bundle - ipad

I add a TextField in the Settings.bundle, it's text is left align default,but I want to let it right align.How can do that.Please help me. Thank you very much!

As far as I can tell types of "Text" (editable) are left aligned and types of "Title" (read-only text) are right aligned.

Related

How to align English and Arabic text in one UITextView correctly?

I have a UITextView which contains both Arabic and English text.
What happens is that both texts get aligned according to the UITextView alignment as follows:
Aligning left: all left
Aligning center: all center
Aligning right: all right
Aligning justify: all left
Aligning ---: all left
Now: What can I do to make Arabic text align right and English text align left where they are in the same UITextView
Note: I saw this question which has the same problem but nobody answered.
Thanks in advance!
EDIT:
The Arabic text maybe included between two English texts and vice versa.
For example:
The is some text
اهلا بكم
More English text

UIButton with two titles one on left another on right

I have a situation where a button title has two parts with different strings, and need to display one on the right and one on the left. Text will change dynamically every time based on response. I have to place this button in a tableview cell. Attaching an image below for reference.
The requirement is as follows:
.
But I managed to do the following:
I am unable to place text on two different sides of a button.
The easiest solution for you may be to place a UILabel on the left and anchor it to the left with a constraint, then place a UILabel on the right, and anchor it to the right with a constraint. - this is mentioned in the comments by #Alejandro Iván.
I would then choose a set value for the right label width and set that label. Add a constraint from the left label to the right label, so it will dynamically fill as much space as is available.
Last I would place a clear, no text button with the border on top, wrapping both labels. You can then confidently change the left label content and know that it will be encompassed in the button border.
Image attached to help you see what I'm saying although I've left the "button" text and added coloration to demonstrate.

Add CALayer to UILabel text

Is there a way to add extra CAShapeLayer( a small box) to uilalbel text. I want it to be placed exactly after the last character of label.
Thank you!
some what like this. an extra layer near to the end of label
If you don't want to go into complexity , try unicode characters & append it in your string with some space if required. You can check in Interface builder. Select label. Go into Edit -> Emoji & Symbols & select dot .Check in attached screenshot.
EDIT
Find position of last character in UILabel text & add CAShapeLayer as subview.It should work.
OR
You can simplify your solution by having 1 UIView with label & CAShapeLayer as subviews.Set origin of layer with label width .

Delete 3 dots on Truncate Head using UILabel

i need to delete the 3 dots in the head of label, how can i do this?
i already tried others types of line breaks but "Truncate Head" is the only that truncate the label in the beginning.
Here is my actual label with 3 dots '...'
I need to do like this:
Any ideas ?
I don't think there is a good way to do this without faking it. You can fake it by giving the label a trailing constraint but not a leading one. and make the text right justified. This has the effect of anchoring the right side and the text will run off the screen to the left. If you put another view in front of it with the same color as the background, this will mask out the extra text.
This isn't supported out of the box, so you'll need to make a custom label class to accomplish this. See the answer on a similar question "How to change truncate characters in UILabel?"
Instead of setting label.text value, set it as attributed text. Like below.
let attrString = NSAttributedString(string: "YOUR Text")
label.attributedText = attrString
After this, your font settings might be disturbed, which you need to set again programmatically for your label.

Margin space UITableView (Swift)

I want to show margin space left and right in UITableView look like images. I used Xcode 7.3.1 and deployment target is 7.0. Please help me! Thanks very much.
You have to add one UIView into cell's contentview and than give constraints to it like below ...
Note: Don't forget to add background color to cell's contentview to see the effect.
Add left and right constraints as shown in pic below. You can change the margin to the value that you need. Dark red (vs dotted red) connectors says the constraints are selected. Click on "Add 2 constraints" to add it.

Resources