开发者

IS there a way to increase the height of the text field apart from increasing the font size

I am trying to increase the height of the UITextField in my app through IB. I have defined开发者_如何学Python these textfield in my IB so i think it needs to be done through IB. Please let me know if there is a way to do it either through IB or through code.

Thanks,


As UITextField subclasses UIView, it inherits UIView's initWithFramemethod.

NSInteger myCustomHeight = 237;
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(10, 10, 200, myCustomHeight)];

If u want do do it through IB then replace the last line with:

textField.frame = CGRectMake(10, 10, 200, myCustomHeight);

This assumes textField is an IBOutlet.


Increasing the height of UITextField is possible. But you cannot get text on next line, you can write text on only one line. It you want to have Textfield look alike you can use UITextView with editing option where you can increase the height and can have text on multiple lines.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜