Note that there are some explanatory texts on larger screens.

plurals
  1. POadd scroll view for a sample form ehich contains few textfields (iphone)
    text
    copied!<p>I have a sign up form defined as following and i like to have this form in a scrollview so that if user selects the textfields in the bottom it scrolls.</p> <p>The thing is that , the sign up form does not cover the whole screen and in the background I still have the main view and I want the textfields to scroll inside the form,without changing the location of the window of the form( I dont want the form view comes up and cover the background).</p> <pre><code> - (UIView *)Form { if (!_Form) { CGRect frame = CGRectMake(0.0, Height, Width, 310.0); UIView *container = [[UIView alloc] initWithFrame:frame]; CGFloat y = 15.0; frame = CGRectMake(15.0, y, width, height); UITextField *field = [[UITextField alloc] initWithFrame:frame]; [ field.placeholder = @"text1*"; 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*"; 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*"; y = frame.origin.y + kDefaultTextFieldHeight + 16.0; CGFloat w = (kDeviceWidth - 2 * 15.0) / 2; frame = CGRectMake(15.0, y, w - 2.0, height); field = [[UITextField alloc] initWithFrame:frame]; field.placeholder = @"First Name*"; frame = CGRectMake(15.0 + w + 2.0, y, w - 2.0, height); field = [[UITextField alloc] initWithFrame:frame]; field.placeholder = @"Last Name*"; [container addSubview:field]; y = frame.origin.y + kDefaultTextFieldHeight + spacing; frame = CGRectMake(15.0, y, w, kDefaultTextFieldHeight); field = [[UITextField alloc] initWithFrame:frame]; field.placeholder = @"Birthday"; y = frame.origin.y + kDefaultTextFieldHeight + 20.0; frame = CGRectMake((container.frame.size.width - 192.0) / 2, y, 192.0, 34.0); y = frame.origin.y + kDefaultTextFieldHeight + 8.0; frame = CGRectMake((container.frame.size.width - 192.0) / 2, y, 192.0, 34.0); _Form = container; } return _Form; } </code></pre> <p>Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload