0

In android all I have to do in the equivalent of "interface builder" is

 android:maxLines="140";//twitter's character limit

Is there an equivalently simple method for iOS?

Katedral Pillon
  • 14,534
  • 25
  • 99
  • 199
  • Not exactly from IB but you can achieve same reuslt by doing this: http://stackoverflow.com/questions/433337/set-the-maximum-character-length-of-a-uitextfield – Amir Oct 16 '14 at 23:39
  • max *lines* or max *characters*? Twitter can obviously not be 140 lines unless there is only one character per line. – borrrden Oct 17 '14 at 01:28

2 Answers2

1

Use the UITextFieldDelegate to listen the length of input, you can see this uitextfield-maximun

also you need adapt the protocol and set the delegate to your textfield.

Community
  • 1
  • 1
Feng Lin
  • 670
  • 4
  • 8
0
int n = 140;

NSString *displaySTR = ......
if ([displaySTR length] > n) {
displaySTR = [string substringToIndex:n];
}
Dean Leitersdorf
  • 1,303
  • 1
  • 11
  • 22