ios - UIAlertView with multiple text inputs? -


    uialertview *alert = [[uialertview alloc]initwithtitle:@"add new work order (test)" message:@"please fill out fields" delegate:self cancelbuttontitle:@"add" otherbuttontitles: nil]; alert.alertviewstyle = uialertviewstyleplaintextinput; uitextfield *alerttextfieldname = [alert textfieldatindex:0]; alerttextfieldname.placeholder = @"work order name"; alerttextfieldname.keyboardtype = uikeyboardtypedefault; uitextfield *alerttextfieldprojectno = [alert textfieldatindex:1]; alerttextfieldprojectno.placeholder = @"projectno"; alerttextfieldprojectno.keyboardtype = uikeyboardtypedefault; uitextfield *alerttextfieldsubname = [alert textfieldatindex:2]; alerttextfieldsubname.placeholder = @"sub account name"; alerttextfieldsubname.keyboardtype = uikeyboardtypedefault; [alert show]; 

im trying error: nsrangeexception', reason: '*** -[__nsarraym objectatindex:]: index 1 beyond bounds [0 .. 0]'

shouldn't able add multiple textfields aletview? -textfieldatindex: give me notion possible. wrong?

use code add mulitple textfield in uialertview

uiview *v = [[uiview alloc] initwithframe:cgrectmake(0, 0, 250, 100)];  uitextfield *textfield1 = [[uitextfield alloc] initwithframe:cgrectmake(10,0,252,25)]; textfield1.borderstyle = uitextborderstyleroundedrect; textfield1.placeholder = @"username"; textfield1.keyboardappearance = uikeyboardappearancealert; textfield1.delegate = self; [v addsubview:textfield1];  uitextfield *textfield2 = [[uitextfield alloc] initwithframe:cgrectmake(10,30,252,25)]; textfield2.placeholder = @"password"; textfield2.borderstyle = uitextborderstyleroundedrect; textfield2.keyboardappearance = uikeyboardappearancealert; textfield2.delegate = self; [v addsubview:textfield2];   uitextfield *textfield3 = [[uitextfield alloc] initwithframe:cgrectmake(10,60,252,25)]; textfield3.placeholder = @"address"; textfield3.borderstyle = uitextborderstyleroundedrect; textfield3.keyboardappearance = uikeyboardappearancealert; textfield3.delegate = self; [v addsubview:textfield3];   uialertview *av = [[uialertview alloc] initwithtitle:@"test" message:@"" delegate:nil cancelbuttontitle:@"no" otherbuttontitles:@"yes", nil]; [av setvalue:v  forkey:@"accessoryview"]; [av show]; 

i hope code useful you.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -