I need help. I'm designing my UI, and I have been using the properties FRAME and CENTER to layout my views. Both of those are so much helpful to me. I also use the technique of adding my elements as subview of UIViews container.
But, right now, I want to place a UIView at the top of another. Please take a look at my picture. The buttons at the bottom of the screen is already set and is perfect right now, I'm only having a hard time to place my UIView (a container of my textfields) above the button/divider.
I'm only starting in iOS, I think 1 month plus already. I know basics of constraints programmatically but I don't want to use this for now as much as possible.
PS. I make my screen programmatically.
Sample of my code in this screen
// start adding container UIView *container2 = [[UIScrollView alloc] init]; container2.frame = CGRectMake(0, 0, [TPRConstants screenWidth] * 0.95, heightOfScrollView); container2.backgroundColor = [UIColor blueColor]; container2.contentSize = CGSizeMake([TPRConstants screenWidth] * 0.95, 250); [self.view container2]; // stuffs and subviews/textfields inside the container self.phoneTextField = [[UITextField alloc] init]; _phoneTextField.frame = CGRectMake(0, 200, scrollView.frame.size.width, 50); _phoneTextField.delegate = self; _phoneTextField.borderStyle = UITextBorderStyleNone; _phoneTextField.background = [UIImage imageNamed:@"textfieldLogIn.png"]; _phoneTextField.backgroundColor = [UIColor clearColor]; [_phoneTextField setKeyboardType:UIKeyboardTypeNumberPad]; [container2 addSubview:_phoneTextField]; // add container for divider and log in button UIView *container = [[UIView alloc] init]; container.frame = CGRectMake(0, 0, [TPRConstants screenWidth], 80); container.backgroundColor = [UIColor whiteColor]; container.center = CGPointMake([TPRConstants screenWidth] * 0.50, [TPRConstants screenHeight] - container.frame.size.height/2); [self.view addSubview:container]; // add divider UIImageView *divider = [[UIImageView alloc] initWithFrame:CGRectMake(0, 10, container.frame.size.width, 5)]; divider.image = [UIImage imageNamed:@"dividerCP.png"]; divider.backgroundColor = [UIColor clearColor]; divider.contentMode = UIViewContentModeCenter; [container addSubview: divider]; // add save login UIButton *saveBtn = [UIButton buttonWithType:UIButtonTypeCustom]; saveBtn.frame = CGRectMake(0, 0, container.frame.size.width * 0.95, 50); saveBtn.center = CGPointMake(container.frame.size.width /2 , (container.frame.size.height - saveBtn.frame.size.height/2) - 10 ); [saveBtn addTarget:self action:@selector(saveBtnClick:) forControlEvents:UIControlEventTouchUpInside]; [saveBtn setBackgroundImage:[UIImage imageNamed:@"logoutupCP.png"] forState:UIControlStateNormal]; [saveBtn setTitle:@"Save" forState:UIControlStateNormal]; [saveBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [saveBtn setTitleColor:[UIColor blackColor] forState:UIControlStateHighlighted]; [saveBtn setBackgroundImage:[UIImage imageNamed:@"logoutdownCP.png"] forState:UIControlStateHighlighted]; [container addSubview: saveBtn]; 