Alertview can mark its own TextView index, which is called by index.
-(void) TableView: (uitableview *) TableView Didselectrowatindexpath: (nsindexpath *) Indexpath
{
[TableView deselectrowatindexpath: Indexpath animated:NO];
if (Indexpath. Section = = 0)
{
Uiactionsheet *actionsheet = [[Uiactionsheet alloc]initwithtitle:nil delegate:self cancelbuttontitle:@ " cancel " Destructivebuttontitle:@ " album " Otherbuttontitles:@ "Take photos ",Nil];
[Actionsheet Showinview: Self. View];
Actionsheet. Destructivebuttonindex = 0;
}
Else if (indexpath. Section = = 1)
{
UITableViewCell *cell = [TableView cellforrowatindexpath:indexpath];
Uialertview *alertview = [[uialertview<] Span class= "S3" > Alloc]initwithtitle:@ " Enter new name " Message:@" " Delegate:self Cancelbuttontitle:@ " cancel " Otherbuttontitles:@" OK "nil
Alertview.alertviewstyle = Uialertviewstyleplaintextinput;
[Alertview show];
// get input box
Uitextfield *tf=[alertview Textfieldatindex:0];
Tf.placeholder = Cell.detailtextlabel. Text;
}
}
-(void) Alertview: (uialertview *) Alertview clickedbuttonatindex: (nsinteger) buttonindex
{
if (Buttonindex = = 1)
{
// get input box
Uitextfield *tf=[alertview Textfieldatindex:0];
if ([TF. Text Trimwhitespace]. length <= 0)
{
[Mthint Toast:@ " cannot be empty " toview:self. View displaytime:2.0f];
return;
}
if (![ self isvalidateuser:tf. Text])
{
[Mthint Toast:@ " name can only be made up of Chinese, letters, or numbers " toview: Self. View displaytime:2.0f];
return;
}
if (TF. Text. length >= )
{
[Mthint Toast:@ ' name needs to be less than ten characters ' toview: Self. View displaytime:2];
return;
}
[titlevalues replaceobjectatindex:1 withobject: Tf.text];
[_tableview reloaddata];
}
}
Using Uialertview's textinput, input the information into UITableViewCell Detailstext.