Thursday, 15 September 2011

xcode - Address UITextField with a variable containing the UITextField name -



xcode - Address UITextField with a variable containing the UITextField name -

i create programmatically several uitextfields showing info sqlite. names in sqlite p01, p02, p03, p04,... don't want duplicate source code, utilize variable store sqlite name , pass value uitextfield. this:

nsstring *strname; (int ivalue= 0; .... strname = nsstring withformat:@"p0%d", ivalue.... uitextfield.text = &strname

result sqlite value attribute p01 shown

is possible , if yes, how it?

first save info sqlite in nsmutablearray. lets name namearray. this,

for(int i=0;i<=namearray.count;i++) { uitextfield *movieview=[[uitextfield alloc] init ]; movieview.frame=cgrectmake(5, 20*i, 259, 20); [movieview setbackgroundcolor:[uicolor clearcolor]]; [movieview settextalignment:nstextalignmentcenter]; [movieview settext:[namearray objectatindex:i]]; [self.view addsubview:movieview]; }

xcode sqlite uitextfield

No comments:

Post a Comment