How to make multiline textField in Xcode? - ios

I have around 25 words, which I need to copy into clipboard (25 different for each category). At first I've made a textView, but it is not possible to copy it into clipboard. So I used a textField, but it doesnt look good, because it has only one line and it doesnt show all of the words.
Is there any way I can make textField multiline or any way to copy content of textView?
Thank you for your reply.

Related

Why does pasting(ctrl-v) sometimes break merged cells in google sheets

I am creating a PO form for my department. I have 2 cells merged with text wrap for the item description. If I copy a product name from Amazon and paste it into these merged cells, the merge breaks and text does not wrap. If I take the same text and paste into google search bar and then recopy the text and paste into the merged cells everything functions as normal. It does not appear to be the length of text but rather the font size that is the issue. Paste special- values only also fixes the problem but I am trying to make this form usable without special instructions. Does anyone have a work around or at least confirm font size can break a cell merge?
Font size is not relevant. You're copying a special character (likely a newline) at the end of the product name, which causes the merged cells to split.
There isn't anything you can do on your side to fix this, copy pasting formatted text directly from a webpage into your sheet will lead to things breaking.
A few options:
Double click on the merged cell, then paste the text into it
Select the merged cell and paste the values into the formula bar
Paste Special - Values
Answer:
I can confirm this does happen.
Workaround:
Instead of merging cells like this:
You can just use one cell and expand its width:
Fixing Font Size:
The only issue here is that if you paste in some text which is font size 18 and Times New Roman, if you don't use the Right Click > Paste Special > Paste values only then the text decoration will persist. You can fix this with a little script which changes the font to normal on edit:
function onEdit(e) {
e.range.setFontSize(10)
.setFontWeight("normal")
.setFontFamily("Arial")
.setFontColor("black")
}
This you will need to paste into the script editor for your sheet, by following the Tools > Script editor menu item. Once pasted, you will need to save the script with Ctrl+S. Anything pasted will now automatically be converted to Arial, size 10, black, normal weight font:

How to format a text like bold/italic in UITextField in Swift iOS?

Here consider this image. I have taken a toolbar with icons for text formatting. After selecting that sentence if I hit B (bold) it should be bold. Even I need that too if I select bold then further text to be show as bold. Consider this textbox UITextField. Incase you have some good reference like github you are welcome. I have already spend two days in a row in SO but not get any proper solution. One bold function is enough for me.

UILabel word wrapping brings extra word to next line when there is enough space for it

Under certain circumstances, UILabel seems to bring an extra word to new line even when there is enough space for it, for example,
If one more word is appended,
Even if I force the width of the label to become something like below, it still moves the word consists of "c"s to the next line,
I've tried twisting the configuration of the UILabel, but seems it behaves the same unless I set the line breaking mode to character wrap, below is the configuration for the above cases,
And the constraints (in the first two cases, the trailing ),
Is there any reason for this particular behaviour and can I fix this? It looks weird in this way leaving that space emptied.
this is the default behavior since iOS 11, to fix orphaned words. No way to shut it off
to fix it
use the text as attributed text
or
use UItextview and turn of the scroll, edit option
or
use the custom label here
Get each line of text in a UILabel
You should set the line break to character wrap, because the letters after the space will be recognized as a word.
Hey I know this is late but I just figured out that you can cheat the system by adding a bunch of spaces at the end of the text.
If text of UILable may be changed, then it's still possible to use quick-dirty hack with "\n" - new line symbol.
Text "Aaaaaaaaaaaaaa bbb cccccccccc\ndddddd" will force UILabel to display:
Aaaaaaaaaaaaaa bbb cccccccccc
ddddddd
In Interface Builder new line can be inputted with Ctrl + Enter
If u use wordWrap, it tries to keep words in full form, as a result of this, it goes to next line. If you use character wrap, it will break on characters, and push the chars onto next line.
For Example:-
My name is ABCXXXX and I (have space here)
love myself.
Solution:-
Use NSMutableAttributedText and write love\n. It will make the "love" be in the space myself in the next line.

swift dynamic numbers of line

i work with ios 8 swift an have a textfield into a table cell.
if i put in this textfield a short text, i have no problems.
but is there a long text, the end of the this will cut, like this:
"This is the Exmaple of ..."
how can i set dynamic a second line in to my textfield, if the text will be to long for it?
i do not have any code because i dont know how i can solve this situation.
UITextField can contains only one line of text. The component you need is the UITextView.

Entering/Clearing specific UITextfields?

My aim is to have text boxes - a set amount per level for people to guess a hidden word. I don't want the UITextfield to be tapped and then bring up the keyboard, I'd like to have a different button that brings up the keyboard - if that's possible.
If each box is a separate text field how could I go about entering text. When a user types on the standard apple keypad, how could each character be inputted into a certain text field. I'd preferably like the text to show in the box as soon as a key is tapped.
I'm also having trouble clearing certain letters. Say a user mis-spells something and doesn't realise until the keyboard has resigned as first responder, how could I make it so that a user can tap on maybe two boxes if the rest of the word is spelt right and the program clear it?
Is there any way of writing the program so that it inputs text only if the text field is empty? Continuing with the example above they switch two letters, they tap to clear, they then bring up the keypad and the next key then pressed fills the empty boxes. Not allowing the program to input text in a used text field that only contains a single character?
I'm using Cocos2d - I don't know if that makes a difference. I hope you understand what I mean, although I'm rather bad at explaining.
Thank you in advance for your time and any help :).
Instead of having a textbox that you don't want users to edit, why not use a label?
To show the keyboard, you need to have it linked to some UITextField (or similar). You could use an invisible UITextField, and then monitor the input and send the characters to the correspinding labels. Refer to this question.
To check if a textfield has anything in it:
[textField.text length] > 0, but I would use labels instead of textfields.
I dont really understand the other parts of your question.

Resources