- I have a ScrollView (coming from a xib file), which works as expected.
- Inside my ScrollView i have a UIView (a little bit smaller than the scroll view). The UIView has userInteractionEnabled = YES
- Inside my UIView is a UITextField which is centered in the middle of the UIView.
The textField only responds to touches when the frame of the textfield is on the top of the UIView. For example when i set the frame to (0,0,280,100) the textfield responds. But with a frame (0,100,280,100) it doesn't work.
The TextField has a height of 100. But it responds only in the upper part of the textField.
Here is the code "not working" (Developing on iOS 7 beta 5). Thanks for help!
page1 = [[UIView alloc] initWithFrame: CGRectMake(5, 5, scrollView.frame.size.width-10,self.scrollView.frame.size.height-10)];
userNameInput = [[UITextField alloc]initWithFrame:CGRectMake(6, 6, 280, 100)];
[userNameInput setCenter:CGPointMake(page1.frame.size.width / 2, page1.frame.size.height / 2.5f)];
[userNameInput setTextAlignment:NSTextAlignmentCenter];
[userNameInput setTextColor:[UIColor whiteColor]];
userNameInput.enabled = YES;
userNameInput.userInteractionEnabled = YES;
userNameInput.placeholder = @"Enter...";
userNameInput.autocorrectionType = UITextAutocorrectionTypeNo;
userNameInput.keyboardType = UIKeyboardTypeDefault;
userNameInput.returnKeyType = UIReturnKeyDone;
userNameInput.clearButtonMode = UITextFieldViewModeWhileEditing;
userNameInput.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
userNameInput.font = [SystemUtils getSystemFontWithTextSize:30.0f];
userNameInput.delegate = self;
userNameInput.tag = 1;
page1.userInteractionEnabled = YES;
[page1 addSubview:userNameInput];
[userNameInput setBackgroundColor:[UIColor blueColor]];
[page1 setBackgroundColor:[UIColor redColor]];
[scrollView setBackgroundColor:[UIColor greenColor]];
[self.scrollView addSubview:page1];