How to change textfield height for an ipad using i

2019-05-13 03:56发布

We're using Interface Builder for developing an app for the iPad and we can't figure out how to increase the height of the textfields.

When we were using IB to develop an application for osx, you could go to the textfields attributes and under the control section you could set line break to word wrap instead of clip.

When we try to use Interface Builder for iPad applications though, it doesn't have the option of changing linebreak style under attributes-->control.

Is there any way to set the height using Interface Builder or do you have to set that in the code?

6条回答
萌系小妹纸
2楼-- · 2019-05-13 04:33

there is a wrapping text field,that is what you need.

查看更多
够拽才男人
3楼-- · 2019-05-13 04:38

It looks like the height of the rounded-style text field is locked in Interface Builder. My solution was to use another of the UITextField styles in my XIB and then call textField.borderStyle = UITextBorderStyleRoundedRect in my viewDidLoad method.

Of course, textField should be the name of the UITextField IBOutlet.

查看更多
Lonely孤独者°
4楼-- · 2019-05-13 04:47

set the frame of ui textfield object in view did load but it will involve coding

[self.searchText setFrame:CGRectMake(180, 450, 400, 250)];
//in my case the object was called search text...
查看更多
ら.Afraid
5楼-- · 2019-05-13 04:48

You can edit the height of any UITextfield in IB.Just set the constraint in IB.Select the constraint.In the Size Inspector-->Select and Edit just change the constant to your desired value.Press Enter ...Done!!!! (Can't get multiline though)

查看更多
SAY GOODBYE
6楼-- · 2019-05-13 04:56

iOS UITextFields are single line only and have a fixed height.

If you want a multi-line, variable-height text entry field then use UITextView.

查看更多
我想做一个坏孩纸
7楼-- · 2019-05-13 04:57

1 - Right click on your storyboard/xib file and select "Open as" -> "Source code".

2 - Find the xml tag relative to your TextField, e.g.

<textField opaque="NO" clipsSubviews="YES" tag="102" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="6872" borderStyle="roundedRect" placeholder="Password" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Dxw-lR-kq5">
<rect key="frame" x="20" y="337" width="335" height="30"/>

3 - Change the height value to what you want (e.g. 50)

4 - Right click again on you storyboard and select "Open as" -> "Interface builder"

5 - See the result

enter image description here

查看更多
登录 后发表回答