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
Post a Comment