In my project, I've set a view as the root view of my app.
In the controller of this root view, I have got such a hierachy:
rootview --[addsubview]-- foregroundView --[addsubview]-- textfield
I've done that in code instead of xib.
In that case, the textfield can not be focused. It seems that nothing happened when I click the textfield on the screen. But if I modified like that :
rootview --[addsubview]-- foregroundView
rootview --[addsubview]-- textfield
Everything worked fine.
Since I wanna make foregroundView and textfield as a group, I prefer to use the former style. Do any have idea of this? Thanks very much.
Here is the core source code for my trouble:
//it's a viewController.m , it's view has been set as the root view for the app.
self.foregroundView = [[UIImageView alloc] initWithFrame:CGRectMake(15, 140, 290, 250)];
UIImage *foregroundImage = [XYZImageProcessor resizeImage:[UIImage imageNamed:@"Texture0203.jpg"] toSize:CGSizeMake(275, 250)];
[self.view addSubview:self.foregroundView ];
self.nickNameTextField = [self.class customTextFieldMake:CGRectMake(80, 200, 150, 30)];
[self.view addSubview:self.nickNameTextField];
//if I change it to [self.foregroundView addSubview:self.nickNameTextField],the textfield can not be focused.