0
私はタブバーベースのアプリケーションを持っています。アプリケーションをはじめて起動したときに表示される条件ページを作成します。タブバーアプリケーションで用語と条件のページを作成する方法
どうすればよいですか?
私はタブバーベースのアプリケーションを持っています。アプリケーションをはじめて起動したときに表示される条件ページを作成します。タブバーアプリケーションで用語と条件のページを作成する方法
どうすればよいですか?
UIAlertViewで利用規約をテキストとして表示したり、モーダルモードで表示することができます。ユーザーが利用規約に同意するを選択してNSUserDefaultsを使用してこれを保存すると、BoolをYESに設定します。アプリが起動するたびにBOOLをチェックします。
XCodeデフォルトテンプレートtabbed application
を使用してサンプルプロジェクトを作成しました。次に、ユーザーが承認するまでの利用条件をアラートビューに示すコードスニペットを示します。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
if(![[NSUserDefaults standardUserDefaults] valueForKey:@"acceptTermsAndConditionsBool"])
{
UIAlertView* tempAlert = [[UIAlertView alloc] initWithTitle:@"Terms And Conditions" message:@"Please read the terms and conditions below for using the app. We may need the app to send us app usage.. blah blah blah" delegate:self cancelButtonTitle:@"Deny" otherButtonTitles:@"Accept", nil];
[tempAlert show];
[tempAlert release];
}
// Override point for customization after application launch.
UIViewController *viewController1 = [[[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil] autorelease];
UIViewController *viewController2 = [[[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil] autorelease];
self.tabBarController = [[[UITabBarController alloc] init] autorelease];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2, nil];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return YES;
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
switch (buttonIndex)
{
case 0:
{
exit(0);
break;
}
case 1:
{
[[NSUserDefaults standardUserDefaults] setObject:@"YES" forKey:@"acceptTermsAndConditionsBool"];
break;
}
default:
break;
}
}