I have a main UIView which moves up by means of a switch. I have this working and there is no problem there. Now the UIView when down, takes up about half of the Screen and when it is pushed up it shows the bottom 40px.
In the UIView when it is down it has a UITextField and it sits somewhere in the middle. When the UIView is pushed up I want that UITextField to move to sit within those 40px, so that it always accessible.
This is the code I got for the UIView to move:
-(IBAction)mainview:(id)sender{
if (uiSwitch.on) {
label.text = @"Push Up View";
[UIView beginAnimations:@"animateView" context:nil];
[UIView setAnimationDuration:0.5];
CGRect viewFrame = [subView frame];
viewFrame.origin.y += 0;
subView.frame = viewFrame;
subView.alpha = 1.0;
[self.view addSubview:subView];
[UIView commitAnimations];
}
if ([uiSwitch isOn] == YES) {
[UIView beginAnimations:@"animateView" context:nil];
[UIView setAnimationDuration:0.5];
CGRect viewFrame = [subView frame];
viewFrame.origin.y = 0;
subView.frame = viewFrame;
[UIView commitAnimations];
}
else {
label.text = @"Show View";
[UIView beginAnimations:@"returnView" context:nil];
[UIView setAnimationDuration:0.5];
CGRect viewFrame = [subView frame];
viewFrame.origin.y = -230;
subView.frame = viewFrame;
subView.alpha = 1.0;
[UIView commitAnimations];
}}
The UITextField is not added to this yet and that is where I am stuck. I know I will probably have to create a similar IBAction for the UITextField, but I am not sure how to animate that bit.
Any Help??? Cheers Jeff