ios - how to add same text field to the same view controller when i click on button each time in objective c x-code6 -


i have code

uitextfield *textfield = [[uitextfield alloc] initwithframe:cgrectmake(18, 350, 309, 35)]; textfield.borderstyle = uitextborderstyleroundedrect; textfield.font = [uifont systemfontofsize:15]; textfield.keyboardtype = uikeyboardtypedefault; textfield.returnkeytype = uireturnkeydone; textfield.contentverticalalignment = uicontrolcontentverticalalignmentcenter; textfield.delegate = self; [self.view addsubview:textfield];..i tried this.. 

but want when click add button ,each time 1 text field added view controller different positions...

thanks in advance.....

try this

if(![self.view viewwithtag:44]){  uitextfield *textfield = [[uitextfield alloc] initwithframe:cgrectmake(18, 350, 309, 35)]; textfield.borderstyle = uitextborderstyleroundedrect; textfield.font = [uifont systemfontofsize:15]; textfield.keyboardtype = uikeyboardtypedefault; textfield.returnkeytype = uireturnkeydone; textfield.contentverticalalignment = uicontrolcontentverticalalignmentcenter;     textfield.delegate = self;     textfield.tag = 44;       [self.view addsubview:textfield]; } 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -