How to add text area in iOS app

10,403

Solution 1

You cannot increase the height of UITextField. for this you need to use UITextView. In your Interface builder where you got UITextField, there is also an option of UITextView. you can use UITextView same as UITextField in iPhone. UITextView is used for multiple lines

UITextView  *txt = [[UITextView  alloc]init];

//set frame

//add on view

[self.view addSubView:txt];

[txt release];

I hope this solves your problem Sample Code for TextView

Solution 2

UITextView  *txt = [[UITextView  alloc]initwithframe:CGRectMake(x, y, width,height)];



[self.view addSubView:txt];

[txt release];
Share:
10,403
Fahim Parkar
Author by

Fahim Parkar

Passionate about programming. First worked as TAB Programmer (MR company programming using Quantam Software) Then started working on JSF platform to make websites. Then shifted to Kuwait & started with iPhone development. After almost 4 years of iPhone development, now in process to Learn Android too... Alhamdullilah!!! Either sleep or code!!! SOreadytohelp

Updated on June 04, 2022

Comments

  • Fahim Parkar
    Fahim Parkar almost 2 years

    I am newbie for iPhone application. I want to add TextArea. I know how to add textField, however can someone help me how can I have Textare in my iPhone application?

    I thought, I can increase the height of textfield and make it multi-line, however that option is not there.

  • Fahim Parkar
    Fahim Parkar over 11 years
    Thanks. No one told me to click option Behavior : Editable. That will do the trick...
  • Ren
    Ren about 11 years
    Please add some form of description as to how the code you posted addresses the problem. Also, you should place any code in your answers within code blocks.