Skip to content

Instantly share code, notes, and snippets.

@NilStack
NilStack / HandleInput.m
Created March 16, 2015 16:55
Handle text input in WatchKit
- (IBAction)handleInput {
NSArray* perdefinedAnswer = @[@"I will call back later.", @"I'm in a meeting now."];
[self presentTextInputControllerWithSuggestions:perdefinedAnswer
allowedInputMode:WKTextInputModeAllowAnimatedEmoji
completion:^(NSArray *results) {
if (results && results.count > 0) {
[self.messageLabel setText:[results objectAtIndex:0]];
}
@NilStack
NilStack / InterfaceController.m
Created June 17, 2015 05:26
code snippet for blog Develop For watchOS 2 2: New UI Elements - Picker
//
// InterfaceController.m
// WatchPicker Extension
//
// Created by Peng on 6/15/15.
// Copyright © 2015 Peng. All rights reserved.
//
#import "InterfaceController.h"
@NilStack
NilStack / InterfaceController.m
Created July 20, 2015 03:55
InterfaceController for blog Develop For watchOS 2 2: New UI Elements - Picker (sequence)
//
// InterfaceController.m
// WatchPicker Extension
//
// Created by Peng Guo on 6/18/15.
// Copyright © 2015 Peng Guo. All rights reserved.
//
#import "InterfaceController.h"
@NilStack
NilStack / InterfaceController.m
Created July 21, 2015 14:49
InterfaceController.m for WKInterfaceMovie example in develop.watch
//
// InterfaceController.m
// WatchMovie Extension
//
// Created by Peng on 7/21/15.
// Copyright © 2015 Peng. All rights reserved.
//
#import "InterfaceController.h"
@NilStack
NilStack / InterfaceController.m
Created July 24, 2015 09:16
InterfaceController.m for alert example in develop.watch
//
// InterfaceController.m
// WatchAlert Extension
//
// Created by Peng on 7/22/15.
// Copyright © 2015 Peng. All rights reserved.
//
#import "InterfaceController.h"
@NilStack
NilStack / FBAnimationPerformanceTracker.h
Last active August 29, 2015 14:26 — forked from clementgenzmer/FBAnimationPerformanceTracker.h
FBAnimationPerformanceTracker
/*
* This is an example provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
@NilStack
NilStack / gist:e5600b9b16dd9d1df48e
Created October 26, 2015 05:07 — forked from timothyarmes/gist:7080170
An implementation of a UINavigationBar subclass for iOS7 which creates a taller navigation bar suitable for adding extra controls underneath the title.The appearance proxy is used for shifting the title and bar button items back up to their original vertical position.Note that it's easy to specify your subclass in XCode: clicking on the UINaviga…
#define kAppNavBarHeight 66.0
@implementation TATallNavigationBar
- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self) {
[self setupAppearance];
}
@NilStack
NilStack / IOMobileFramebuffer.h
Created January 10, 2016 12:30 — forked from anthonya1999/IOMobileFramebuffer.h
A recent disassembly of IOMobileFramebuffer framework
/* You may have to include your IOSurface header to compile, because of the GetLayerDefaultSurface function. If you do not have it, you may just uncomment the typedef to an IOSurface below. */
#include <stdio.h>
#include <sys/mman.h>
#ifdef __cplusplus
extern "C" {
#endif
#define kIOMobileFramebufferError 0xE0000000
@NilStack
NilStack / RVNReceiptValidation.m
Created March 10, 2016 10:30
Mac App Store Receipt Validation Sample (Mac OS X 10.7)
//
// RVNReceiptValidation.m
//
// Created by Satoshi Numata on 12/06/30.
// Copyright (c) 2012 Sazameki and Satoshi Numata, Ph.D. All rights reserved.
//
// This sample shows how to write the Mac App Store receipt validation code.
// Replace kRVNBundleID and kRVNBundleVersion with your own ones.
//
// This sample is provided because the coding sample found in "Validating Mac App Store Receipts"
@NilStack
NilStack / UIDeviceHardware.h
Created August 7, 2016 01:45 — forked from Jaybles/UIDeviceHardware.h
UIDeviceHardware - Determine iOS device being used
//
// UIDeviceHardware.h
//
// Used to determine EXACT version of device software is running on.
#import <Foundation/Foundation.h>
@interface UIDeviceHardware : NSObject
- (NSString *) platform;