Skip to content

Instantly share code, notes, and snippets.

+ (UIImage *)installButtonBackground:(BOOL)fill
{
CGFloat borderWidth = 1.0;
CGFloat cornerRadius = 3.0;
CGSize size = CGSizeMake((cornerRadius * 2) + 1.0, (cornerRadius * 2) + 1.0);
UIColor *buttonColor = [UIColor installButtonColor];
UIGraphicsBeginImageContextWithOptions(size, NO, 0.0);
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake((borderWidth / 2), (borderWidth / 2), size.width - borderWidth, size.height - borderWidth) byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(cornerRadius, cornerRadius)];
Incident Identifier: 2986E199-B268-464A-883E-362B59A00AD0
CrashReporter Key: c68af6ee22388954851f65669288c7fb6e1c03dc
Hardware Model: iPad4,1
OS Version: iPhone OS 7.1.2 (11D257)
Kernel Version: Darwin Kernel Version 14.0.0: Thu May 15 23:17:54 PDT 2014; root:xnu-2423.10.71~1/RELEASE_ARM64_S5L8960X
Date: 2014-10-21 09:58:46 +0100
Time since snapshot: 218 ms
Free pages: 1951
Active pages: 133010
#pragma mark - Keyboard Appearance
- (void)keyboardWillShow:(NSNotification *)notification
{
NSDictionary* info = [notification userInfo];
CGRect keyboardFrame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
keyboardFrame = [self.view.window convertRect:keyboardFrame toView:self.view];
CGRect intersectRect = CGRectIntersection(self.view.frame, keyboardFrame);
@liamnichols
liamnichols / gist:6413368
Created September 2, 2013 14:19
Renders all the sublayers of all the subviews within a specified view to file
static NSString *dir = @"/Users/liam.nichols/Desktop/layers/";
-(void)sublayersToFile
{
for (UIWindow *window in [[UIApplication sharedApplication] windows])
{
if ([window isKindOfClass:NSClassFromString(@"UITextEffectsWindow")])
{
[self subviewsInView:window];
break;
@liamnichols
liamnichols / UIColor+STColor.m
Created September 10, 2013 15:02
UIColor to UIImage
#pragma mark - UIImage Representations
- (UIImage *)imageRepresentation
{
CGFloat scale = [[UIScreen mainScreen] scale];
CGRect rect = CGRectMake(0, 0, scale, scale);
CGColorSpaceRef rgbColorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef context = CGBitmapContextCreate(NULL, CGRectGetWidth(rect), CGRectGetHeight(rect), 8, 0, rgbColorSpace, kCGImageAlphaPremultipliedFirst);
//
// Created by Liam Nichols on 06/08/2013.
// Copyright (c) 2013 Liam Nichols. All rights reserved.
//
// To change the template use AppCode | Preferences | File Templates.
//
#import "LNCollectionViewPagedLayout.h"
//Pull all the policy option hash's into memory
NSManagedObjectContext *managedObjectContext = [[SalesManager sharedSalesManager] managedObjectContext];
NSExpressionDescription* objectIdDesc = [NSExpressionDescription new];
objectIdDesc.name = @"objectID";
objectIdDesc.expression = [NSExpression expressionForEvaluatedObject];
objectIdDesc.expressionResultType = NSObjectIDAttributeType;
NSFetchRequest *search = [NSFetchRequest fetchRequestWithEntityName:[ExtraPrice entityName]];
search.resultType = NSDictionaryResultType;
search.returnsDistinctResults = YES;
// System Device Type (iPhone1,0) (Formatted = iPhone 1)
+ (NSString *)systemDeviceTypeFormatted:(BOOL)formatted {
// Set up a Device Type String
NSString *DeviceType;
// Check if it should be formatted
if (formatted) {
// Formatted
@try {
// Set up a new Device Type String
// System Device Type (iPhone1,0) (Formatted = iPhone 1)
+ (NSString *)systemDeviceTypeFormatted:(BOOL)formatted {
// Set up a Device Type String
NSString *DeviceType;
// Check if it should be formatted
if (formatted) {
// Formatted
@try {
// Set up a new Device Type String
- (void)applicationDidEnterBackground:(UIApplication *)application
{
self.window.layer.rasterizationScale = 0.1f;
self.window.layer.shouldRasterize = YES;
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
self.window.layer.rasterizationScale = 1.0f;
self.window.layer.shouldRasterize = NO;