objective c - iOS edit TextField of Uialertview -
code:
uialertview *alertview = [[uialertview alloc] initwithtitle:@"name search" message:@"save search as" delegate:nil cancelbuttontitle:@"cancel" otherbuttontitles:@"ok", nil] ; alertview.tag = 20; alertview.delegate = self; alertview.cancelbuttonindex = 1; alertview.alertviewstyle = uialertviewstyleplaintextinput; [alertview show]; - (bool)alertviewshouldenablefirstotherbutton:(uialertview *)alertview { if(alertview.tag == 20){ uitextfield *textfield = [alertview textfieldatindex:0]; textfield.text = @"testing"; if ([textfield.text length] == 0){ return no; } } return yes; }
i created uialerview textinput mode.i did set textvalue in textbox.it not allow me edit textfield value when alertview appears.what wrong code?thanks in advance
add line : textfield.userinteractionenabled = yes;
after line : textfield.text = @"testing";
Comments
Post a Comment