Skip to content

Instantly share code, notes, and snippets.

View imack's full-sized avatar

Ian MacKinnon imack

View GitHub Profile
@imack
imack / gist:be25ecf0407200f009bf
Created August 8, 2014 16:47
Ian's bobble Head Xmas Card
// Position Variables
var x = 0;
var y =0;
var initial_x = 169;
var initial_y = 111;
// Speed - Velocity
var vx = 0;
var vy = 0;
@imack
imack / PlaceMark.h
Last active August 29, 2015 14:05
A Brief Overview of MKAnnotation protocol
//
// PlaceMark.h
// Nina
//
// Created by Ian MacKinnon on 11-08-22.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
@imack
imack / CreateImageViewController.h
Last active August 29, 2015 14:05
UIImagePicker Example
#import <UIKit/UIKit.h>
@interface CreateImageViewController : UIViewController<UIImagePickerControllerDelegate, UINavigationControllerDelegate, UIActionSheetDelegate>
@property(nonatomic, strong) IBOutlet UIImageView *imageView;
@end
//
// TunesTableViewController.m
// ItunesPlay
//
// Created by Ian MacKinnon on 2014-08-17.
// Copyright (c) 2014 Ian MacKinnon. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <MediaPlayer/MediaPlayer.h>
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
// Set the application defaults
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSDictionary *appDefaults = [NSDictionary dictionaryWithObject:@"YES"
forKey:@"showTutorial"];
[defaults registerDefaults:appDefaults];
[defaults synchronize];
@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)];
}
@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 / 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"
//
// main.m
// W1D4
//
// Created by Ian MacKinnon on 2015-01-15.
// Copyright (c) 2015 Ian MacKinnon. All rights reserved.
//
#import <Foundation/Foundation.h>