Skip to content

Instantly share code, notes, and snippets.

@reesemclean
Created October 8, 2011 08:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reesemclean/1272012 to your computer and use it in GitHub Desktop.
Save reesemclean/1272012 to your computer and use it in GitHub Desktop.
//This is called passing in the view controller to launch from
//Raising the minimum to 4.0 to get blocks, an even better version would be
//-(BOOL) launchSmartotsEngineControllerInViewController:(UIViewController *)viewController withCompletionHandler:(void (^)())block;
//Doing it this way gets me an animated transition and all I have to do is call
//[[SmarTotsEngine sharedInstance] setLandscape:UIInterfaceOrientationIsLandscape(self.interfaceOrientation)];
//right before and then I don't have to worry about rotation.
-(BOOL) launchSmartotsEngineControllerInViewController:(UIViewController *)viewController {
if ([self.hasCheckAPIKey isEqualToString:@"disabled"]) {
ALERTVIEW_(@"SmarTots Disabled",@"This App has SmarTots integrated, but has been disabled. Please tell the developer to contact us at SmarTots.com to re-enable SmarTots functionality.",@"OK");
return NO;
}else if ([self.hasCheckAPIKey isEqualToString:@"testing"]) {
ALERTVIEW_(@"SmarTots Developer Warning",@"This App has SmarTots integrated, but has not yet been enabled. Please be sure to enable this app at SmarTots.com before submitting it to the App Store.",@"OK");
}
[[SmarTotsEngine sharedInstance] OnParentButtonClick];
//DismissableKeyboardNavigationController is a subclass with disablesAutomaticKeyboardDismissal overridden to return NO
self.navigationController = [[[DismissableKeyboardNavigationController alloc] init] autorelease];
self.navigationController.view.frame = viewController.view.frame;
self.navigationController.modalPresentationStyle = UIModalPresentationFullScreen;
self.navigationController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
self.navigationController.view.hidden = NO;
if ([[SmarTotsEngine sharedInstance] readAuthFromLocal])
{
ParentsCheckViewController * viewToShow = [[ParentsCheckViewController alloc] initWithNibName:[[SmarTotsEngine sharedInstance] getFullNibName:@"ParentsCheckViewController"] bundle:nil];
viewToShow.title = @"SmarTots";
viewToShow.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:viewToShow animated:YES];
[viewToShow release];
} else {
SignupSplashScreenViewController * viewToShow = [[SignupSplashScreenViewController alloc] initWithNibName:[[SmarTotsEngine sharedInstance] getFullNibName:@"SignupSplashScreenViewController"] bundle:nil];
viewToShow.title = @"SmarTots";
viewToShow.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:viewToShow animated:YES];
[viewToShow release];
}
[viewController presentModalViewController:navigationController animated:YES];
return YES;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment