Skip to content

Instantly share code, notes, and snippets.

@idan
Created May 29, 2013 23:40
Show Gist options
  • Save idan/5674700 to your computer and use it in GitHub Desktop.
Save idan/5674700 to your computer and use it in GitHub Desktop.
//
// BLAppDelegate.m
// Braid
//
// Created by Idan Gazit on 5/14/13.
// Copyright (c) 2013 BraidLabs. All rights reserved.
//
#import "BLAppDelegate.h"
#import "BLFirstRunViewController.h"
@implementation BLAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
BLFirstRunViewController *gmailViewController = [[BLFirstRunViewController alloc]
initWithNibName:@"BLFirstRunViewController" bundle:nil];
gmailViewController.stepTitle.text = @"Let’s Get Started.";
gmailViewController.stepSubtitle.text = @"Braid works with your existing GMail account.";
gmailViewController.stepImage.image = [UIImage imageNamed:@"Mail.png"];
self.firstrunNavigationController = [[UINavigationController alloc]
initWithRootViewController:gmailViewController];
[self.firstrunNavigationController setNavigationBarHidden:YES];
self.window.rootViewController = self.firstrunNavigationController;
[self.window makeKeyAndVisible];
return YES;
}
// ... more stuff
@end
//
// BLFirstRunViewController.h
// Braid
//
// Created by Idan Gazit on 5/29/13.
// Copyright (c) 2013 BraidLabs. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface BLFirstRunViewController : UIViewController
@property (weak, nonatomic) IBOutlet UILabel *stepTitle;
@property (weak, nonatomic) IBOutlet UIImageView *stepImage;
@property (weak, nonatomic) IBOutlet UILabel *stepSubtitle;
@property (weak, nonatomic) IBOutlet UIButton *stepButton;
- (IBAction)stepButtonTouchUp:(id)sender;
@end
//
// BLFirstRunViewController.m
// Braid
//
// Created by Idan Gazit on 5/29/13.
// Copyright (c) 2013 BraidLabs. All rights reserved.
//
#import "BLFirstRunViewController.h"
@interface BLFirstRunViewController ()
@end
@implementation BLFirstRunViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
_stepTitle.font = [UIFont fontWithName:@"OpenSans-Light" size:28.0];
_stepSubtitle.font = [UIFont fontWithName:@"OpenSans-Light" size:20];
_stepButton.titleLabel.font = [UIFont fontWithName:@"OpenSans-Bold" size:15];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)stepButtonTouchUp:(id)sender {
}
@end
@idan
Copy link
Author

idan commented May 30, 2013

What I'm trying to do here:

BLFirstRunViewController is a generic "First run" view, containing a title, subtitle, image, and button.

If you imagine a first-run flow with several steps (authorize contacts, auth calendar, auth gmail, etc..), each of the steps has the same look but different labels/image/button text.

What I'm trying to do is make a generic view controller that I can instantiate over and over, programmatically setting the appropriate labels. Each time a step is complete, I'll instantiate the next "first run" step, and push it onto the firstrunNavigationController.

What should I be doing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment