Wednesday, 15 August 2012

uiscrollview - put the sigUp form(includes several textField s) into the scroll Viewer template(iphone) -



uiscrollview - put the sigUp form(includes several textField s) into the scroll Viewer template(iphone) -

i have designed sign form next , contains several textfields , every time user clicks on textfield keyboard comes or datepicker birthday date. sign form comes using tap.

but form jumps , cover whole screen,

how can alter viewdidload , design of code 1)have sign form in scroll view format avoid form jump in screen?

- (uiview *)signupform { if (!_signupform) { cgrect frame = cgrectmake(0.0, ksignupviewvisibleheight, kdevicewidth, 310.0); uiview *container = [[uiview alloc] initwithframe:frame]; cgfloat y = 15.0; frame = cgrectmake(15.0, y, kdevicewidth - 2*15.0, kdefaulttextfieldheight); uitextfield *field = [[uitextfield alloc] initwithframe:frame]; field.placeholder = @"email*"; field.keyboardtype = uikeyboardtypeemailaddress; [container addsubview:field]; self.email = field; self. email.delegate = self; self.email.clearbuttonmode = uitextfieldviewmodewhileediting; cgfloat spacing = 8.0; y = frame.origin.y + kdefaulttextfieldheight + spacing; frame = cgrectmake(15.0, y, kdevicewidth - 2*15.0, kdefaulttextfieldheight); field = [[uitextfield alloc] initwithframe:frame]; field.placeholder = @"password*"; field.securetextentry = yes; [container addsubview:field]; self.password = field; self.password.delegate = self; self. password.autocapitalizationtype = uitextautocapitalizationtypenone; self. password.clearbuttonmode = uitextfieldviewmodewhileediting; frame.size.height = 200.0; y = frame.origin.y + kdefaulttextfieldheight + spacing; frame = cgrectmake(15.0, y, kdevicewidth - 2*15.0, kdefaulttextfieldheight); field = [[uitextfield alloc] initwithframe:frame]; field.placeholder = @"confirm password*"; field.securetextentry = yes; [container addsubview:field]; self.confirmpassword = field; self. confirmpassword.delegate = self; self. confirmpassword.autocapitalizationtype = uitextautocapitalizationtypenone; self.registrationformconfirmpassword.clearbuttonmode = uitextfieldviewmodewhileediting; y = frame.origin.y + kdefaulttextfieldheight + 16.0; cgfloat w = (kdevicewidth - 2 * 15.0) / 2; frame = cgrectmake(15.0, y, w - 2.0, kdefaulttextfieldheight); field = [[uitextfield alloc] initwithframe:frame]; field.placeholder = @"first name*"; [container addsubview:field]; self.firstname = field; self. firstname.delegate = self; self. firstname.clearbuttonmode = uitextfieldviewmodewhileediting; frame = cgrectmake(15.0 + w + 2.0, y, w - 2.0, kdefaulttextfieldheight); field = [[uitextfield alloc] initwithframe:frame]; field.placeholder = @"last name*"; [container addsubview:field]; self.lastname = field; self.lastname.delegate = self; self.lastname.clearbuttonmode = uitextfieldviewmodewhileediting; y = frame.origin.y + kdefaulttextfieldheight + spacing; frame = cgrectmake(15.0, y, w, kdefaulttextfieldheight); field = [[uitextfield alloc] initwithframe:frame]; [self.appdel.stylemanager decoratetextfield:field]; field.placeholder = @"birthday"; [container addsubview:field]; self.birthday = field; self.birthday.delegate = self; uibutton *signupbutton = [uibutton buttonwithtype:uibuttontypecustom]; signupbutton.frame = frame; [signupbutton settitle:@"sign up" forstate:uicontrolstatenormal]; [signupbutton addtarget:self action:@selector(signup:) forcontrolevents:uicontroleventtouchupinside]; [container addsubview:signupbutton]; y = frame.origin.y + kdefaulttextfieldheight + 8.0; frame = cgrectmake((container.frame.size.width - 192.0) / 2, y, 192.0, 34.0); uibutton *cancelbutton = [uibutton buttonwithtype:uibuttontypecustom]; cancelbutton.frame = frame; [cancelbutton settitle:@"cancel" forstate:uicontrolstatenormal]; [self.appdel.stylemanager decoratebutton:cancelbutton]; [cancelbutton addtarget:self action:@selector(cancelregistration:) forcontrolevents:uicontroleventtouchupinside]; [container addsubview:cancelbutton]; _signupform = container; } homecoming _ signupform; } - (void)viewdidload { [super viewdidload]; [self.navigationcontroller setnavigationbarhidden:yes]; self.view.backgroundcolor = [self.appdel.stylemanager appbackgroundgradientwithframe:self.view.bounds]; uitapgesturerecognizer *tap = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(endpageedit:)]; tap.delegate = self; [self.view addgesturerecognizer:tap]; [self.appdel.stylemanager decoratebutton:self.loginwithemailbutton]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(keyboarddidshow:) name:uikeyboarddidshownotification object:nil]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(keyboarddidhide:) name:uikeyboarddidhidenotification object:nil];

here solution issue, gona work sure http://www.iphonesampleapps.com/2009/12/adjust-uitextfield-hidden-behind-keyboard-with-uiscrollview/

iphone uiscrollview viewdidload

No comments:

Post a Comment