Get UITableView of different uitextfield inputs in each row (for example, to change the login password)

Source: Internet
Author: User

@interface Aztpasswordmodifyviewcontroller () <uitableviewdelegate, Uitableviewdatasource>{

nsstring *_theoldpassword;

nsstring *_thenewpassword;

nsstring *_thetwicenewpassword;

}

-(UITableViewCell *) TableView: (UITableView *) TableView Cellforrowatindexpath: (nsindexpath*) Indexpath

{

Nsinteger row = [Indexpath row];

static NSString *cellidentifier = @ "Cellidentifier";

UITableViewCell *cell = [TableView dequeuereusablecellwithidentifier:cellidentifier];

if (cell = = nil) {

cell = [[[UITableViewCell alloc] Initwithstyle:uitableviewcellstyledefault Reuseidentifier:cellidentifier] Autorelease];

Cell.selectionstyle = Uitableviewcellselectionstylenone;

}

Cell.textLabel.text = [_passwordarray objectatindex:row];

CGRect textfieldrect = CGRectMake (0.0, 0.0f, 215.0f, 31.0f);

Uitextfield *thetextfield = [[Uitextfield alloc] initwithframe:textfieldrect];

Thetextfield.contentverticalalignment = Uicontrolcontentverticalalignmentcenter;

Thetextfield.returnkeytype = Uireturnkeydone;

Thetextfield.securetextentry = YES;

Thetextfield.clearbuttonmode = YES;

Thetextfield.tag = row;

Thetextfield.delegate = self;

This method is the key method

[Thetextfield addtarget:self Action: @selector (Textfieldwithtext:) forcontrolevents:uicontroleventeditingchanged];

Switch (ROW) {

Case 0:

Thetextfield.placeholder = @ "Please enter the old password";

Break

Case 1:

Thetextfield.placeholder = @ "Please enter a new password";

Break

Case 2:

Thetextfield.placeholder = @ "Please enter the new password again";

Break

Default

Break

}

Cell.accessoryview = Thetextfield;

[Thetextfield release];

return cell;

}

-(void) Textfieldwithtext: (Uitextfield *) TextField

{

Switch (Textfield.tag) {

Case 0:

Self.theoldpassword = Textfield.text;

Break

Case 1:

Self.thenewpassword = Textfield.text;

Break

Case 2:

Self.thetwicenewpassword = Textfield.text;

Break

Default

Break

}

}

Get UITableView of different uitextfield inputs in each row (for example, to change the login password)

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.