How to resize the UITextField in IOS - ios

- How to increase the height of the text field in order to accommodate multiple lines, as the text field grows accordingly.
- I want something like multiple line attribute in android.

UITextField not supporting multiple lines text place UITextView in the place of UITextField.

Look at UITextView and not a UITextField.

Use HPGrowingTextView for iOS for multiple lines textview

Related

Make multiline UILabel wrap a button

I am using storyboard to design my UIView. But I've stuck at the task: I have a multiline UILabel, UIView and UIButton. I want to make UILabel to wrap my button - the fist line of the text has a trailing constraint to UIButton another one to it's super view. And if my UILabel has no text I got a view at the bottom of label and I need to make this view trailing constraint to UIButton but if I got a free space - to it's superview.
Screenshot example:
I want to jump second line word after 'pyat' . Sorry for my poor english, hope that picture could help to explain my question.
Is it possible to make it directly in IB?
Perhaps instead of using UILabel you can try UITextView by using its textView.textContainer.exclusionPaths property to define a button container area to exclude.
Have a look at the sample code with a reported issue for selected and editable case.
As I remember you must limit the app deployment target minimum to 7 or later if using this property.
Hope that helps!
What you want to do is not supported out of the box and will take a lot of work because it will require subclassing UILabel and overriding drawRect.
An easy solution is to set attributed text on the label and use that to format the specific word to look like a button. UILabel attributed text supports hyperlink like behavior.

Which component use for displaying a paragraph of text in iOS?

I want to show a paragraph of text. I have tried UILabel but this makes the text vertically aligned: it does not start from top. If I use UITextView and disable the properties selectable and editable it behaves like UILabel. Which component should I use?
You can use UILabel to TextView with NSAttributtedString.
Also you can also set your ULLabel or textview text attribute from storyboard .

UIView with long text UILabel could not display text that out of screen height

Hey Im new to IOS development, here is the situation, I have UIView displaying a long text with UILable, actually the text is somehow long and the exceed the screen size, but the UIView don't have a scrollbar or other control to drag down to view the text, is there any ways to do that?
Thanks!
You should use UITextView instead of UILabel. You can disable UITextView for editing like this.
txtview.editable = NO;
UITextView will automatically add scroll if the text is long then UITextView frame.
Hope this helps.
Here is what you need to do, decrease the height of the UIView in which the UILabel is , also use UITextView instead of UILabel.

add button in textview -xcode

How can I add a button in textview? for example..
textView.text=#"text here\n\n text also here\n\n text here aswell";
How can I add a button after each "\n\n" or along the text?
You can create a object of UIButton and add it as subview to yout textview.
You need to preset the frame of the button So the text must be statis and you must know the position of the button in advance.
so your \n\n creates a paragraphs
You can do it without static text just split your text in separate textviews by \n\n, add them to your scrollview. You have to measure your text paragraphs height to set the right frame for textviews and leave gaps for buttons. I would rather use tableview so you dont have to worry about that. Add buttons in between, it is doable.
you may reconsider adding buttons along the text this way (you can but it is really convoluted way of doing things), use webview for that as already stated here by others

iOS - how do I make a text field taller than 1 line?

I am making my first text field, and I am looking for more of a text area that the person can fill out. Xcode disables for me the ability to extend it to more than one line. Is it possible? If so, how do I do that?
Thanks!
You want a UITextView, which is an editable field that can accomodate more than one line of text.
A multiline UITextField is implemented by the UITextView and making sure its editable property is set to YES.
The UITextView class implements the behavior for a scrollable, multiline text region.

Resources