Skip to content

Instantly share code, notes, and snippets.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UIStoryboard *destinationChooser = [UIStoryboard storyboardWithName:@"DestinationChooser" bundle:nil];
self.window.rootViewController = [destinationChooser instantiateInitialViewController];
[self.window makeKeyAndVisible];
if (![[AfarCurrentUser sharedCurrentUser] isSignedIn]) {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Welcome" bundle:nil];
UINavigationController *nav = [storyboard instantiateInitialViewController];
- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UINavController *centerNav = [[UINavController alloc] initWithRootViewController:[FeaturedViewController new]];
centerNav.restorationIdentifier = @"centerNav";
UINavigationController *leftDrawerNavController = [[UINavigationController alloc] initWithRootViewController:[LeftDrawerViewController new]];
leftDrawerNavController.restorationIdentifier = @"leftDrawerNav";
MMDrawerController *drawerViewController = [[MMDrawerController alloc] initWithCenterViewController:centerNav leftDrawerViewController:leftDrawerNavController];
// no restoration class, since this will always be created before state restoration resumes, and therefore will be found implicitly
/*
Basic setup of my app:
MMDrawerViewController (custom container view controller
LeftDrawerViewController
CenterViewController
FeaturedViewController (wrapped in a NavControlelr, initial vc at launch, but can be swapped out by interacting with menu in LeftDrawerVC)
SearchViewController (wrapped in a NavControlelr, loads within CenterVC when appropriate menu item is tapped in LeftDrawerVC)
I can get one scenario to work. as mentioned above, Featured is the first VC that is shown as a child of CenterViewController.
If I tap a button in FeaturedVC to change it's background color, when the app is restored, so is the background color.
module Experiment
class MagazineRegisterWall
CONTROL_ALTERNATIVE = 'full_article'
def initialize(signed_in)
@signed_in = signed_in
@alternative ||= alternative
@analytics_group ||= analytics_group
end
@djibouti33
djibouti33 / gist:5121436
Last active December 14, 2015 17:19
solution to convert place hours of operation from google place details api to a human readable format.
# the data we get from google looks like:
# - close:
# day: 0
# time: '1700'
# open:
# day: 0
# time: '1000'
# - close:
# day: 3
# time: '1700'
@djibouti33
djibouti33 / delay_loading_map.m
Created August 23, 2012 18:40
Delayed map loading
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
// loading the map seems to be the most taxing to the main thread, so
// we hold off on loading it until absolutely necessary of if we think
// we can do it without the user experiencing any scrolling hitches.
// here, we're seeing if the user has scrolled down to the mapShell.
// if so, we load the map.
// top left of our mapShell
float targetPixel = CGRectGetMinY(self.mapShell.frame);