๐
This file contains hidden or 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
// http://stackoverflow.com/questions/969130/how-to-print-out-the-method-name-and-line-number-and-conditionally-disable-nslog/969291#969291 | |
#ifdef DEBUG | |
# define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__) | |
#else | |
# define DLog(...) | |
#endif | |
// ALog always displays output regardless of the DEBUG setting | |
#define ALog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__) |
This file contains hidden or 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
// http://stackoverflow.com/questions/3599160/unused-parameter-warnings-in-c-code | |
#define UNUSED(x) (void)(x) |
This file contains hidden or 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
#define OMNIA_SINGLETON_H(name) + (instancetype)name; | |
#define OMNIA_SINGLETON_M(name) + (instancetype)name { static dispatch_once_t onceToken; static id instance = nil; dispatch_once(&onceToken, ^{ instance = [[self alloc] init]; }); return instance; } |
This file contains hidden or 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
// Taken from the commercial iOS PDF framework http://pspdfkit.com. | |
// Copyright (c) 2013 Peter Steinberger. All rights reserved. | |
// Licensed under MIT (http://opensource.org/licenses/MIT) | |
// | |
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it. | |
#import <objc/runtime.h> | |
#import <objc/message.h> | |
// Compile-time selector checks. |
This file contains hidden or 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
// | |
// NSArray+NegativeIndexes.m | |
// Allow Negative Array Literals | |
// | |
// Created by Matthew Robinson on 25th October 2012. | |
// Copyright (c) 2012 Matthew Robinson. All rights reserved. | |
// | |
// WARNING: This is a proof of concept and should not be used | |
// in production code. This could break at anytime. |
This file contains hidden or 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
// http://stackoverflow.com/questions/9746417/keyboard-willshow-and-willhide-vs-rotation/14351009#14351009 | |
- (void) keyboardWillShow:(NSNotification *)aNotification | |
{ | |
CGRect keyboardFrame = [[[aNotification userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue]; | |
CGRect convertedFrame = [self.view convertRect:keyboardFrame fromView:self.view.window]; | |
...... | |
/* Do whatever you want now with the new frame. | |
* The width and height will actually be correct now |
This file contains hidden or 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)switchRootViewController:(UIViewController *)viewController | |
animated:(BOOL)animated | |
completion:(void (^)())completion | |
{ | |
UIWindow *window = self.appDelegate.window; | |
if (animated) { | |
[UIView transitionWithView:window | |
duration:0.3 | |
options:UIViewAnimationOptionTransitionCrossDissolve |
This file contains hidden or 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
// FLEXUtitlity | |
+ (UIImage *)circularImageWithColor:(UIColor *)color radius:(CGFloat)radius | |
{ | |
CGFloat diameter = radius * 2.0; | |
UIGraphicsBeginImageContextWithOptions(CGSizeMake(diameter, diameter), NO, 0.0); | |
CGContextRef imageContext = UIGraphicsGetCurrentContext(); | |
CGContextSetFillColorWithColor(imageContext, [color CGColor]); | |
CGContextFillEllipseInRect(imageContext, CGRectMake(0, 0, diameter, diameter)); | |
UIImage *circularImage = UIGraphicsGetImageFromCurrentImageContext(); |
This file contains hidden or 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
// SVProgressHUD | |
- (CGFloat)visibleKeyboardHeight { | |
UIWindow *keyboardWindow = nil; | |
for (UIWindow *testWindow in [[UIApplication sharedApplication] windows]) { | |
if(![[testWindow class] isEqual:[UIWindow class]]) { | |
keyboardWindow = testWindow; | |
break; | |
} |
This file contains hidden or 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
FOUNDATION_EXPORT NSString *const NSKeyValueChangeKindKey; |