Using Uialertview's textinput, input the information into UITableViewCell Detailstext.

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.