简体   繁体   中英

iPhone, slide down help screen

I like the effect used in many iPhone apps where a semi-transparent help screen slides from the top (or bottom) on top of the current view to show hints or tips. This screen often has a close button as well as "don't show this again" button.

What's the best approach to slide a view on top of the current view for such an effect? Any code example someone can point me towards?

Thanks

You will want to do something like this from the main view controller..

-(void)showHelp
{
     HelpViewController *controller = [[HelpViewController alloc]init];
     [self presentModalViewController:controller animated:YES];
     [controller release];
}

and the done button would either call back to the main controller or dismiss itself using

- (void)dismissModalViewControllerAnimated:(BOOL)animated

Here is the documentation on the UIViewController class. The methods you require can be found there.

The don't show again feature means you will have to save their selection to NSUserDefaults or somewhere else(sqllite,file system). Then you can read that back when your app launches to determine if you should call showHelp.

From your description, and looking at iPhone Human Interface Guidelines , you want UIActionSheet since a modal view isn't semi-transparent by default.

UIActionSheet is also nicer to work with for what you want. You should be able to achieve your goal in a single line.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM