iphone - How to access UITextField in UITableView through tag in several functions -


i have several uitextfield in uitableview. have assigned different tags fields problem facing accessing uitextfield several other functions.

how access them? here code:-

uitextfield *textfield = (uitextfield *)[self.view viewwithtag:0];

can help?

i have same feature in 1 of apps , used below code accomplish , never had kind of problem.

first of need store textfield value temporary in array. make array this.

arrtemp=[[nsmutablearray alloc]initwithobjects:[nsstring stringwithformat:@""],  [nsstring stringwithformat:@""],  [nsstring stringwithformat:@""],  [nsstring stringwithformat:@""],  [nsstring stringwithformat:@""],  [nsstring stringwithformat:@""],  [nsstring stringwithformat:@""],  [nsstring stringwithformat:@""],  [nsstring stringwithformat:@""],nil]; 

then give textfield tag = indexpath.row;

after need replace textfield value in below 2 methods.

-(bool)textfieldshouldreturn:(uitextfield *)textfield{    [arrtemp replaceobjectatindex:textfield.tag withobject:textfield.text]; }  -(void)textfielddidendediting:(uitextfield *)textfield{  [arrtemp replaceobjectatindex:textfield.tag withobject:textfield.text]; } 

at last need set value in cellforrowatindexpath datasource method. whenever user scroll tableview set previous value temp array. this.

cell.txtentry.text = [arrtemp objectatindex:indexpath.row]; 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -