I am adding a subview to my finalview which is used to change prefrences on the app. I add it like this from my finalview
getPrefrencesViewController = [[GetPrefrencesViewController alloc] init];
getPrefrencesViewController.view setBackgroundColor:[UIColor clearColor]];
getPrefrencesViewController.view.frame = CGRectMake(0.0, 480.0, 320.0, 480.0);
getPrefrencesViewController.prefToolBar.frame = CGRectMake(0.0, 9.0, 320.0, 45.0);
[getPrefrencesViewController.view addSubview:getPrefrencesViewController.prefToolBar];
getPrefrencesViewController.prefTableView.frame = CGRectMake(0.0, 54.0, 320.0, 435.0);
[getPrefrencesViewController.view addSubview:getPrefrencesViewController.prefTableView];
[self.navigationController.view insertSubview:getPrefrencesViewController.view aboveSubview:self.navigationController.view];
[UIView animateWithDuration:0.3
delay:0.0f
options:UIViewAnimationOptionCurveEaseIn
animations:^{
getPrefrencesViewController.view.frame = CGRectMake(0.0, 10.0, 320.0, 480.0);
} completion:^(BOOL finished) {
if (finished) {
NSLog(@"YAY!");
}
}];
}
This works fine...
When the new view is added as a subview I have a UIToolBar with two buttons save and cancel, when the user touches cancel this code is used
- (IBAction)cancleUIButton:(id)sender {
//unload portrait view
[UIView animateWithDuration:0.4
delay:0.0f
options:UIViewAnimationOptionCurveEaseIn
animations:^{
self.view.frame = CGRectMake(0.0, 480.0, 320.0, 480.0);
} completion:^(BOOL finished) {
if (finished) {
// remove subView for superView
[self.view removeFromSuperview];
}
}];
}
as you can see i add the subview, animate it upwards, then when the user presses cancel I animate the view then remove it from superview.. however if I then load it again all the values I change but not saved are still changed, meaning the view is never removed.
I am hoping someone can tell me why this view is never getting removed? any help would be greatly appreciated.