Skip to content

Instantly share code, notes, and snippets.

View imack's full-sized avatar

Ian MacKinnon imack

View GitHub Profile
@imack
imack / Circle.h
Created June 18, 2015 17:18
W7D4 - Object Oriented Design
//
// Circle.h
// Shapes
//
// Created by Ian MacKinnon on 2015-06-18.
// Copyright (c) 2015 Ian MacKinnon. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "Shape.h"
@imack
imack / CreatureProtocol.h
Created June 12, 2015 15:03
Protocols, delegates, and Categories
//
// CreatureProtocol.h
// Classroom
//
// Created by Ian MacKinnon on 2015-06-12.
// Copyright (c) 2015 Ian MacKinnon. All rights reserved.
//
@protocol CreatureProtocol <NSObject>
@imack
imack / Classroom.h
Last active August 29, 2015 14:16
Cool Student Classroom
//
// Classroom.h
// LighthouseClassroom
//
// Created by Ian MacKinnon on 2015-07-02.
// Copyright (c) 2015 Ian MacKinnon. All rights reserved.
//
#import <Foundation/Foundation.h>
@imack
imack / AreaCalculator.h
Last active August 29, 2015 14:16
ShapeArea
#import <Foundation/Foundation.h>
@interface AreaCalculator : NSObject
+(float) calculateArea:(NSArray*)shapes;
@end
//
// main.m
// W1D4
//
// Created by Ian MacKinnon on 2015-01-15.
// Copyright (c) 2015 Ian MacKinnon. All rights reserved.
//
#import <Foundation/Foundation.h>
@imack
imack / ViewController.m
Last active August 29, 2015 14:07
Pan Example
//
// ViewController.m
// GestureRecognizers
//
// Created by Ian MacKinnon on 2014-10-16.
// Copyright (c) 2014 Ian MacKinnon. All rights reserved.
//
#import "ViewController.h"
@imack
imack / ViewController.m
Last active September 23, 2016 21:00
Simple UIImagePicker Example
//
// ViewController.m
// PhotoExample
//
// Created by Ian MacKinnon on 2016-09-23.
// Copyright © 2016 Ian MacKinnon. All rights reserved.
//
#import "ViewController.h"
@imack
imack / Access
Last active August 29, 2015 14:06
Push Notification Snippets
if ([[UIApplication sharedApplication] respondsToSelector:@selector(isRegisteredForRemoteNotifications)]){
// iOS 8 Notifications
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
} else {
// iOS < 8 Notifications
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
}
// Set the application defaults
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSDictionary *appDefaults = [NSDictionary dictionaryWithObject:@"YES"
forKey:@"showTutorial"];
[defaults registerDefaults:appDefaults];
[defaults synchronize];
Basically, UIPasteBoard allows us to share data to other application. Below is an example of UIpasteBoard usage.
COPY
UIPasteboard *appPasteBoard = [UIPasteboard generalPasteboard];
appPasteBoard.persistent = YES;
[appPasteBoard setString:@"STRING TO COPY"];
PASTE