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
+ (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)]; |
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
NSMutableAttributedString *string = [[NSMutableAttributedString alloc] init]; | |
//Total Part | |
[string appendAttributedString:[[NSAttributedString alloc] initWithString:@"Total: " attributes:[self standardAttributes]]]; | |
//Main Price Part | |
[string appendAttributedString:[[NSAttributedString alloc] initWithString:@"£99.10" attributes:[self boldAttributes]]]; |
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
NSFetchRequest *search = [NSFetchRequest fetchRequestWithEntityName:@"<<ENTITY NAME>>"]; | |
search.resultType = NSDictionaryResultType; | |
search.returnsDistinctResults = YES; | |
search.propertiesToFetch = @[ @"<<ID KEY>>" ]; | |
NSArray *results = [managedObjectContext executeFetchRequest:search error:nil]; | |
NSSet *allIDs = [NSSet setWithArray:[results valueForKeyPath:@"<<ID KEY>>"]]; |
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
// | |
// Created by Liam Nichols on 14/10/2013. | |
// Copyright (c) 2013 Mubaloo Ltd. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
@interface LNOrderedMutableDictionary : NSMutableDictionary | |
///If `anObject` is nil, it will not be added to the dictionary. |
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
+ (UIColor *)colorFromString:(NSString *)string | |
{ | |
if (![string isKindOfClass:[NSString class]] && (string.length != 3 || string.length != 6 || string.length != 8)) | |
return [UIColor USPGrayColour]; | |
if (string.length == 3) | |
{ | |
NSMutableString *str = [NSMutableString new]; | |
for(int i =0 ;i<[string length]; i++) | |
{ |
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)applicationDidFinishLaunching:(NSNotification *)aNotification | |
{ | |
self.manager = [[CBCentralManager alloc] initWithDelegate:self queue:nil options:nil]; | |
} | |
-(void)centralManagerDidUpdateState:(CBCentralManager *)central | |
{ | |
if (self.manager.state == CBCentralManagerStatePoweredOn) | |
{ | |
[self.manager scanForPeripheralsWithServices:nil options:nil]; |
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)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; |
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
/* | |
File: UIImage+ImageEffects.h | |
Abstract: This is a category of UIImage that adds methods to apply blur and tint effects to an image. This is the code you’ll want to look out to find out how to use vImage to efficiently calculate a blur. | |
Version: 1.0 | |
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple | |
Inc. ("Apple") in consideration of your agreement to the following | |
terms, and your use, installation, modification or redistribution of | |
this Apple software constitutes acceptance of these terms. If you do | |
not agree with these terms, please do not use, install, modify or |
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
// 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 |
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
// 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 |