presentViewController and UIViewController layout

743 Views Asked by At

I have a UIViewController that has a parent UITabBarController. At the start the UIViewController is located above the UITabBarController. after returning from the call to address book the UIViewController is located below it (its height increased suddenly)

the call is [self presentViewController:picker animated:YES completion:nil]

picker is the ABPeoplePickerNavigationController

Thanks, roi

1

There are 1 best solutions below

0
On

Its very different to say, what you need, we have no some your code, but I try to help: Try to change [self presentViewController:picker animated:YES completion:nil] on

[self.navigationController presentViewController:picker animated:YES completion:nil]
//or [anyNavController presentViewController:picker animated:YES completion:nil]

If it's not help, try to set ViewController's view (which presenting) height in viewDidLoad Or you can try to presenting newView without navigation controller:

newView.bounds = mainView.bounds; //newView can be nextViewController.view
newView.biunds.size.height=newView.biunds.size.height-  self.navBar.bounds.size.height;//devide navBar height (you can delete this line)                   
newView.frame = CGRectMake(newView.frame.origin.x + 784, newView.frame.origin.y,   newView.frame.size.width, newView.frame.size.height);
[mainView addSubview:newView];

/* Begin transition */
[UIView beginAnimations:@"Slide Left" context:oldView];
[UIView setAnimationDelegate:self];
[UIView setAnimationDelay:0.0f];
[UIView setAnimationDuration:0.5f];
[UIView setAnimationDidStopSelector:@selector(slideInCompleted:finished:context:)];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
newView.frame = CGRectMake(0,0, newView.frame.size.width, newView.frame.size.height);
oldView.frame = CGRectMake(oldView.frame.origin.x - 784, oldView.frame.origin.y,     oldView.frame.size.width, oldView.frame.size.height);
[UIView commitAnimations];

Post comments, how is your result.