iphone - Can't get values from text fields from UITableView -


i have uitableview used username/password enter. have problem values when click on button. how make table:

- (uitableviewcell *)tableview:(uitableview *)table cellforrowatindexpath:(nsindexpath *)indexpath {      static nsstring *kcellidentifier = @"cell";      uitableviewcell *cell = [self.tableview dequeuereusablecellwithidentifier:kcellidentifier];     if (cell == nil) {         cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault                                        reuseidentifier:kcellidentifier];         cell.accessorytype = uitableviewcellaccessorynone;          if ([indexpath section] == 0) {             uitextfield *playertextfield = [[uitextfield alloc] initwithframe:cgrectmake(110, 10, 185, 30)];             playertextfield.adjustsfontsizetofitwidth = yes;             playertextfield.textcolor = [uicolor blackcolor];             if ([indexpath row] == 0) {                 playertextfield.placeholder = @"example@gmail.com";                 playertextfield.keyboardtype = uikeyboardtypeemailaddress;                 playertextfield.returnkeytype = uireturnkeynext;             }             else {                 playertextfield.placeholder = @"required";                 playertextfield.keyboardtype = uikeyboardtypedefault;                 playertextfield.returnkeytype = uireturnkeydone;                 playertextfield.securetextentry = yes;             }             playertextfield.backgroundcolor = [uicolor whitecolor];             playertextfield.autocorrectiontype = uitextautocorrectiontypeno;             playertextfield.autocapitalizationtype = uitextautocapitalizationtypenone;             playertextfield.textalignment = nstextalignmentleft;             playertextfield.tag = 0;              playertextfield.clearbuttonmode = uitextfieldviewmodenever;             [playertextfield setenabled: yes];              playertextfield.backgroundcolor = [uicolor clearcolor];              cell.selectionstyle = uitableviewcellselectionstylenone;              [cell addsubview:playertextfield];          }     }     if ([indexpath section] == 0) { // email & password section         if ([indexpath row] == 0) { // email             cell.textlabel.text = @"email";         }         else {             cell.textlabel.text = @"password";         }     }     return cell; } 

and have tried in button tap:

... (uitableviewcell* acell in [self.tableview visiblecells] ) {         uitextfield* afield = (uitextfield *)[acell viewwithtag:0];         nslog(afield.text);     } .. 

this prints me just: email password (labels not data entered). how entered values here?

all views default tag 0. because of this, [acell viewwithtag: 0] returning first view tag 0 - in case cell's textlabel - uilabel responds .text. if set tags in cellforrowatindexpath: other 0 should start working you.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -