I created a user interface a while ago using presentModalViewController to animate the view from the bottom up. Today I decided to change it so that it animates from right to left with pushViewController, but I can't figure out what I have to do make it work. I think it has to do with how I created the first View....
The above code executes when the user taps a "Profile" button in a view without a navigation bar. The view animates from the bottom up.
The ProfileView is a TableView and when the user taps one of it's rows I am executing the following code...
Using presentModalView everything works as advertised with the locationSearchView animating from the bottom up.
I thought all I needed to do to change the animation to be from right to left was to replace the presentModalViewController with pushViewController, which I have commented out in the above code sample. It does not work, however. I do not get any errors but when I tap the row nothing happens.
Is this because I used presentModalViewController to display the profileView? What do I have to do to be able to have the profileView animate bottom up and the subsequent locationSearchViewController animate right to left.
Thanks,
John
Code:
- (void)profile
{
ProfileViewController *profileViewController = [[ProfileViewController alloc] initWithNibName:@"ProfileViewController" bundle:nil];
UINavigationBar *profileNavigationBar = [[UINavigationBar alloc] initWithFrame: CGRectMake(0,0,480,52)];
profileNavigationBar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
UINavigationItem *navItem = [[UINavigationItem alloc] initWithTitle: @"Traveler's Profile"];
navItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem: UIBarButtonSystemItemDone target:self action: @selector(profileDidDismiss)];
[profileNavigationBar pushNavigationItem: navItem animated: NO];
[profileViewController.view addSubview:profileNavigationBar];
[self presentModalViewController:profileViewController animated:YES];
[profileViewController release];
[profileNavigationBar release];
[navItem release];
}
The above code executes when the user taps a "Profile" button in a view without a navigation bar. The view animates from the bottom up.
The ProfileView is a TableView and when the user taps one of it's rows I am executing the following code...
Code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if((indexPath.section == 1) && (indexPath.row == 0)){
LocationSearchViewController *locationSearchViewController = [[LocationSearchViewController alloc] initWithNibName:@"LocationSearchViewController" bundle:nil];
locationSearchViewController.delegate = self;
UITableViewCell *cell = [myTableView cellForRowAtIndexPath:indexPath];
locationSearchViewController.defaultLocation = cell.detailTextLabel.text;
//[self.navigationController pushViewController:locationSearchViewController animated:YES];
[self presentModalViewController:locationSearchViewController animated:YES];
[locationSearchViewController release];
}
}
Using presentModalView everything works as advertised with the locationSearchView animating from the bottom up.
I thought all I needed to do to change the animation to be from right to left was to replace the presentModalViewController with pushViewController, which I have commented out in the above code sample. It does not work, however. I do not get any errors but when I tap the row nothing happens.
Is this because I used presentModalViewController to display the profileView? What do I have to do to be able to have the profileView animate bottom up and the subsequent locationSearchViewController animate right to left.
Thanks,
John