views:

529

answers:

3

So I have an app where you play a game, and at the end it asks you your name for recording of the high score. I would like to use a modal view to accomplish this, but I am experiencing some hiccups along the way. So far, all I have is the modal view sliding up all the way to the top of the screen, but there isn't anything there yet, it's just blank:

    UINavigationController *navController = [UINavigationController new];
    [self presentModalViewController:navController animated:YES];

I have seen on several other iPhone apps, the ability to make the modal view come only half way up the screen (or less) and then have a textfield where you can receive input, such as for my high score list. How would I go about restricing the size of the modal view? And perhaps adding a textfield onto it? Any help would be appreciated! Thanks

+2  A: 

What makes you think presentModalViewController was used?

You can do this quite easily with an UIViewController and animation.

Jordan
I'll look into that, thanks very much for your help.
Steve
A: 

Using Animation, a sample would look like something like this:

        //Move Screen UP:
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDuration:0.5];
    [UIView setAnimationBeginsFromCurrentState:YES];
    self.view.frame = CGRectMake(self.view.frame.origin.x, (self.view.frame.origin.y - kTextView_Keyboard_Offset), self.view.frame.size.width, self.view.frame.size.height);
    [UIView commitAnimations];

Where the "kTextView_Keyboard_Offset is defined in my Contants. You would specify/replace with your Offset value equal the number of pixels in the direction that you would like to move.

Newbyman
A: 

Define a full-screen view with a transparent background - then put the obscuring content wherever you like.

Then you just bring it up as you would any other modal view.

Kendall Helmstetter Gelner