This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.pageViewController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil]; | |
self.dataSource = [PageViewControllerDataSource new]; | |
self.pageViewController.dataSource = self.dataSource; | |
[self.pageViewController setViewControllers:@[[self.dataSource initialViewController]] direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:nil]; | |
// We need to add the pageViewController as a childViewController (so that the lifecycle methods get called together. And then we can add the main view of the pageViewController to this viewController's main view. | |
[self addChildViewController:self.pageViewController]; | |
[self.view addSubview:self.pageViewController.view]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIViewController *)initialViewController { | |
ContentViewController *viewController = [ContentViewController new]; | |
viewController.index = 0; | |
viewController.name = [[ContentController sharedInstance].content[0] description]; | |
return viewController; | |
} | |
- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (IBAction)takePhoto:(id)sender { | |
self.photoCount++; | |
[self.tableView reloadData]; | |
} | |
#pragma mark - Table view data source | |
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | |
PhotoTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"PhotoCell"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)savePhoto:(UIImage *)photo completion:(void (^)(void))completion { | |
CGSize scaledSize = CGSizeMake(512, 512); | |
if (photo.size.width > photo.size.height) { | |
CGFloat ratio = photo.size.height / photo.size.width; | |
scaledSize.height = round(scaledSize.width * ratio); | |
} else { | |
CGFloat ratio = photo.size.width / photo.size.height; | |
scaledSize.width = round(scaledSize.height * ratio); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// RARecipes.h | |
// Recipe App | |
// | |
// Created by Joshua Howland on 5/22/14. | |
// Copyright (c) 2014 DevMountain. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static CGFloat margin = 15; | |
static NSString * const Command = @"command"; | |
static NSString * const Reference = @"reference"; | |
- (NSArray *)gitCommands { | |
return @[@{Command: @"git status", Reference: @": shows changed files"}, | |
@{Command: @"git diff", Reference: @": shows actual changes"}, | |
@{Command: @"git add .", Reference: @": adds changed files to the commit"}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func gitCommands() -> Array<[String: String]> { | |
var commands = [[String: String]]() | |
commands.append([Command: "git status", Reference: ": shows changed files"]) | |
commands.append([Command: "git diff", Reference: ": shows actual changes"]) | |
commands.append([Command: "git add .", Reference: ": adds changed files to the commit"]) | |
commands.append([Command: "git commit -m \"notes\"", Reference: ": commits the changes"]) | |
commands.append([Command: "git push origin _branch_", Reference: ": pushes commits to branch named _branch_"]) | |
commands.append([Command: "git log", Reference: ": displays progress log"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Stack.m | |
// | |
// Created by Joshua Howland on 6/12/14. | |
// Copyright (c) 2014 DevMountain. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
@import CoreData; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See tic tac toe by Lenli https://github.com/lenli/tictactoe | |
-(BOOL)isGameOver { | |
NSArray *winCombinations = [[NSArray alloc] initWithObjects: @[@1,@2,@3], @[@4,@5,@6], @[@7,@8,@9], | |
@[@1,@4,@7], @[@2,@5,@8], @[@3,@6,@9], | |
@[@1,@5,@9], @[@3,@5,@7], nil]; | |
for (NSArray *winCombination in winCombinations) { | |
BOOL isWinner = TRUE; | |
for (NSNumber *winIndex in winCombination) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (NSArray *)data { | |
return @[ | |
[self fruits], | |
[self liquids], | |
[self desserts] | |
]; | |
} |