ios - UITextField automatically begins editing mode -
i have 3 uitextfields inside of uitableview (3 separate rows). first 2 standard uitextfields require text input third requires data entry , associated uidatepicker.
problem statement: when screen loads, third text field automatically begins editing , pops date picker. annoying. want screen wait user begin input before doing anything. please find below viewdidload code. / insight appreciated
- (void)viewdidload { [super viewdidload]; [scrollview setcontentsize:cgsizemake(320, 910)]; expirationdatepicker.hidden = yes; expirationdatepicker.date = [nsdate date]; [expirationdatepicker addtarget:self action:@selector(changedatevalue:) forcontrolevents:uicontroleventvaluechanged]; [self configureview]; } - (void)configureview { nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentspath = [paths objectatindex:0]; //get docs directory nsstring *filepath = [documentspath stringbyappendingpathcomponent:[self.detailitem cardname]]; filepath = [filepath stringbyappendingpathextension:@".png"]; nsdata *pngdata = [nsdata datawithcontentsoffile:filepath]; imgpickerbutton.imageview.image = [uiimage imagewithdata:pngdata]; } attached screenshot taken after screen loads. can see third text field has entered editing mode.

one way would convert date text field uibutton in custom uitableviewcell , bring date picker when user touches button.
and when user done selecting date, change title of button reflect date.
Comments
Post a Comment