iphone - Request for member 'uitextfield' in something not a structure or union? -


working through several other problems have found myself @ point. have learnt alot stuff trying 1 stumped on.

i writing textfield format login have on app, , because apple don't have resembling textfield mask have decided write own custom cell looks has mask on doing concatenating textfields in background.

however have struck problem. trying call textfield:shouldchangecharactersinrange:replacementstring: of uitextfield in subclassed uitableviewcell outlined in code below. im receiving request member 'uitextfield' in not structure or union error... appreciated.

////.h

@interface registerdeviceviewcontroller : uiviewcontroller <uitableviewdelegate, uitextfielddelegate> {      registerdeviceviewcontroller *registerdeviceviewcontroller;      //uitextfields registration cell     uitextfield *regfieldone;     uitextfield *regfieldtwo;     uitextfield *regfieldthree;     uitextfield *regfieldfour;      uitableviewcell *myregistrationfield;     uitableviewcell *mysubmitbutton;  } //uitextfields registration cell @property (nonatomic, retain) iboutlet uitextfield *regfieldone; @property (nonatomic, retain) iboutlet uitextfield *regfieldtwo; @property (nonatomic, retain) iboutlet uitextfield *regfieldthree; @property (nonatomic, retain) iboutlet uitextfield *regfieldfour;  @property (nonatomic, retain) iboutlet uitableviewcell *myregistrationfield; @property (nonatomic, retain) iboutlet uitableviewcell *mysubmitbutton;  @end 

/////.m

#import "registerdeviceviewcontroller.h"   @implementation registerdeviceviewcontroller  //custom registration cell fields @synthesize regfieldone; @synthesize regfieldtwo; @synthesize regfieldthree; @synthesize regfieldfour;  @synthesize myregistrationfield; @synthesize mysubmitbutton;  // implement viewdidload additional setup after loading view, typically nib. - (void)viewdidload {     self.title = @"registration";     [super viewdidload]; }     //sets number of sections in table - (nsinteger)numberofsectionsintableview:(uitableview *)tableview {     return 2; }  // sets number of rows in each section. - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {     return 1; }  //loads both custom cells each section - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {      uitableviewcell *cell = (uitableviewcell *)[tableview dequeuereusablecellwithidentifier:@"mythingy"];     if (cell == nil) {         cell = myregistrationfield;     }       uitableviewcell *cellbutton = (uitableviewcell *)[tableview dequeuereusablecellwithidentifier:@"mummy"];     if (cellbutton == nil) {         cellbutton = mysubmitbutton;     }      if (indexpath.section == 0) {         return cell;          cell.regfieldone.delegate = self; //this error is.     }     return cellbutton;  }  //this delegate method not being called. //textfield:shouldchangecharactersinrange:replacementstring: - (bool)textfield:(uitextfield *)textfield shouldchangecharactersinrange:(nsrange)range replacementstring:(nsstring *)string {     int length = [regfieldone.text length] ;     if (length >= maxlength && ![string isequaltostring:@""]) {         regfieldone.text = [regfieldone.text substringtoindex:maxlength];         return no;     }     return yes; }  .......... 

regfielddone not member of cell (table view cell). member of class register device view controller. if trying set regfielddone's delegate self, change statement regfielddone.delegate = self

edit: can directly set text field's delegate registerdeviceviewcontroller (file owner) xib file.

you have set regfielddone's delegate self, other textfield's delegate? when edit other textfield's, delegate method not called.

you should notice shouldchangecharactersinrange... method gets called while editing regfielddone , doesnt while editing other textfield's. advice set textfield's delegate self, either programatically or xib file.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -