Si vous devez avoir un UITextField avec 2 lignes de texte, une option consiste à ajouter un UILabel en tant que sous-vue de UITextField pour la deuxième ligne de texte. J'ai un UITextField dans mon application que les utilisateurs ne réalisent pas souvent est éditable en appuyant sur, et je voulais ajouter un petit texte de sous-titre qui dit "Appuyez sur Modifier" à l'UITextField.
CGFloat tapLlblHeight = 10;
UILabel *tapEditLbl = [[UILabel alloc] initWithFrame:CGRectMake(20, textField.frame.size.height - tapLlblHeight - 2, 70, tapLlblHeight)];
tapEditLbl.backgroundColor = [UIColor clearColor];
tapEditLbl.textColor = [UIColor whiteColor];
tapEditLbl.text = @"Tap to Edit";
[textField addSubview:tapEditLbl];