2012-05-31 3 views
0

В моем UIViewController <GLKViewDelegate> необходимо сделать простой ввод текста при выборе объекта.Cocoa touch: многострочный текстовый ввод

Есть ли в UIKit простой многострочный ввод текста, готовый к использованию?

Я уже нашел UIAlertView с alertViewStyle=UIAlertViewStylePlainTextInput, но это всего лишь простой ввод строки.

thx

ответ

3

Если вы имеете в виду есть эквивалент ввода текста UIAlertView с UITextView а не UITextField, ответ - нет.

+0

[Нажмите здесь Ashley] (http://stackoverflow.com/questions/3410372/iphone-sdk-adding-a-textfield -to-uialertview-does-not-work-in-ios-4) – Filoo

+0

Абсолютно вы можете опрокинуть свой собственный, но вопрос был «** Есть ли в UIKit простой многострочный ввод текста, готовый к использованию **», поэтому ответ - нет. –

0

Ваш вопрос не очень ясен. но я думаю, что UIActionSheet - это то, что вам нужно.

Редактировать

Вы можете попробовать это

Установите это ип .h файл делегат как этот

@interface NameOfYourClass : UIViewController <UIActionSheetDelegate> 

и добавить код в un .m Файл

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Action Sheet" delegate:self cancelButtonTitle:@"Cancel Button" destructiveButtonTitle:@"Destructive Button" otherButtonTitles:@"Other Button 1", @"Other Button 2", nil]; 

    actionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque; 

    [actionSheet showInView:self.view]; 

Edit2

Итак, вот что нужно сделать, чтобы добавить текстовое поле в ваш allertview

UIAlertView *newAlert =[[UIAlertView alloc] initWithTitle:@"ADD item" message:@"Put it blank textfield will cover this" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil]; 

    UITextField *newTextField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 45.0, 260.0, 25.0)]; 
    [email protected]""; 
    [newTextField setBackgroundColor:[UIColor whiteColor]]; 
    [newTextField setKeyboardAppearance:UIKeyboardAppearanceAlert]; 
    [newTextField setAutocorrectionType:UITextAutocorrectionTypeNo]; 

    [newTextField setTextAlignment:UITextAlignmentCenter]; 
    [newAlert addSubview:newTextField]; 

    [newAlert show]; 
+0

Yup Я немного обновлю вопрос. Изменить: сделано. –

+0

Вы пробовали этот код? что вам нужно? – Filoo

+0

Да, ваш код не работает. Невозможно делегировать самостоятельно –