views:

75

answers:

2

Hi,

I added a modalView to my App, everything working fine, but on closing the modal, the whole modalView jumps about 1-2 centimeters to left while it disappears.

I did not find any reason for it yet, so here is the code regarding modal:

AppController:

- (void) showNameModal:(Player *)player 
{
    namesModal = [[PlayerModalView alloc] init];
    namesModal.delegate = self;
    namesModal.player = player;

    UINavigationController *navCon = [[UINavigationController alloc] initWithRootViewController:namesModal];

    navCon.modalPresentationStyle = UIModalPresentationFormSheet;
    [self presentModalViewController:navCon animated:YES];

    [navCon release];
    [namesModal release];
 }

 - (void)didDismissModalView 
 {
    [self dismissModalViewControllerAnimated:YES];
 }

ModalView:

 - (void)dismissView:(id)sender 
 {
    [delegate didDismissModalView];
 }

called via navigation buttons as well ass via keyboard by

  [self dismissView:nil];

As you can see, there is nothing special in it, could be taken from a manual actually. What happens in detail:

Modal appears in center of screen, slides in from the bottom. centered all time. i can handle some actions in the modalView, it stays centered.

now, dismissing the view makes it jumping to the left, than slides out.

Since it's a forced landscape-right app (currently), I was only able to notify the left-jump.

Any ideas how to get this jumping away?

Thanks

A: 

Try this,

- (void)didmissView:(id)sender
{
   [self.navigationController didmissModelViewControllerAnimated:YES];
}
Toro
oki, that crashes the app, *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present a nil modal view controller.. so i guess i oversee something..
dhanke
I remember ModelView should dissmiss itself. The one who present the modelView has no responsibility to dismiss the modelView. But I feel strange, why does the one who present the modelView become nil ?
Toro
A: 

You are not modally presenting an instance of PlayerModalView but rather a UINavigationController. The left jerk you see is most likely the default animation of the navigation controller attempting a slide transform to the (non-existant) previous view.

It doesn't sound like you need a navigation controller for the PlayerModalView. Instead, you should create an ordinary view controller for it.

TechZen
the PlayerModalView actually should have a Navigation-Bar, therefore i`d choose a UINavigationController. However, what do you mean by "(non-existant)" ?
dhanke
It turns out, that its an orientation problem. only on 3.2.2, 4.2 works fine. Simulatorresults differ completely from Hardware too.. Thank you a lot anyways!
dhanke