๐
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://w3facility.info/question/how-do-i-force-xcode-to-rebuild-the-info-plist-file-in-my-project-every-time-i-build-the-project/#answer-18578076 | |
# ---------------------------- IMPORTANT ---------------------------- | |
# You must set GITHash to something like 'Set by build script' in the file | |
# file '<Project Name>-Info.plist' in the 'Supporting Files' group | |
# ------------------------------------------------------------------- | |
# | |
# Get the version number from the tag in git and the number of commits as the build number | |
# |
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://ioscodesnippet.com/2011/08/27/nsstringf-simpler-printf-styled-nsstring/ | |
NSString *NSStringf(NSString *format, ...) { | |
va_list ap; | |
NSString *str; | |
va_start(ap,format); | |
str=[[NSString alloc] initWithFormat:format arguments:ap]; | |
va_end(ap); | |
return [str autorelease]; |
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 UA_isIPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) | |
#define UA_isIPhone (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) | |
#define UA_isRetinaDevice ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] && [[UIScreen mainScreen] scale] >= 2) | |
#define UA_isMultiTaskingSupported ([[UIDevice currentDevice] respondsToSelector:@selector(isMultitaskingSupported)] && [[UIDevice currentDevice] isMultitaskingSupported]) | |
#define UA_runOnMainThread if (![NSThread isMainThread]) { dispatch_sync(dispatch_get_main_queue(), ^{ [self performSelector:_cmd]; }); return; }; |
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://paul-samuels.com/blog/2012/10/13/simple-developer-happiness-gains/ | |
#!/usr/bin/env ruby | |
require 'shellwords' | |
proj = Dir['*.xcworkspace'].first | |
proj = Dir['*.xcodeproj'].first unless proj | |
if proj |
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
//FTGPopoverController.h | |
@interface FTGPopoverController : NSObject | |
- (instancetype)initWithContentVC:(UIViewController *)contentVC contentSize:(CGSize)contentSize; | |
- (void)presentInVC:(UIViewController *)vc fromButton:(UIButton *)button; | |
- (void)dismiss; | |
- (BOOL)isVisible; | |
@end |
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 SUPPRESS_PERFORM_SELECTOR_LEAK_WARNING(code) \ | |
_Pragma("clang diagnostic push") \ | |
_Pragma("clang diagnostic ignored \"-Warc-performSelector-leaks\"") \ | |
code; \ | |
_Pragma("clang diagnostic pop") \ | |
#define SUPPRESS_UNDECLARED_SELECTOR_LEAK_WARNING(code) \ | |
_Pragma("clang diagnostic push") \ | |
_Pragma("clang diagnostic ignored \"-Wundeclared-selector\"") \ | |
code; \ |
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/18403578/how-can-i-add-shadow-to-a-circle-uiimageview | |
``` | |
[self.imageView.layer setCornerRadius:60.0]; | |
[self.imageView.layer setMasksToBounds:YES]; | |
self.imageView.clipsToBounds = YES; | |
self.container.backgroundColor = [UIColor clearColor]; | |
self.container.layer.shadowColor = [UIColor blackColor].CGColor; | |
self.container.layer.shadowOffset = CGSizeMake(5,15); |
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
// .h | |
#import <Foundation/Foundation.h> | |
typedef void (^FTGHandler)(); | |
@interface FTGActionSheetController : NSObject | |
- (instancetype)initWithTitle:(NSString *)title; | |
- (instancetype)initWithTitle:(NSString *)title | |
cancelButtonTitle:(NSString *)cancelButtonTitle |
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
// .h | |
#import <Foundation/Foundation.h> | |
typedef void (^FTGHandler)(); | |
@interface FTGAlertController : NSObject | |
- (instancetype)initWithTitle:(NSString *)title | |
message:(NSString *)message; | |
- (instancetype)initWithTitle:(NSString *)title |
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
- (NSLayoutConstraint *)constraintForAttribute:(NSLayoutAttribute)attribute | |
{ | |
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"firstAttribute = %d && (firstItem = %@ || secondItem = %@)", attribute, self, self]; | |
NSArray *constraintArray = [self.superview constraints]; | |
if (attribute == NSLayoutAttributeWidth || attribute == NSLayoutAttributeHeight) { | |
constraintArray = [self constraints]; | |
} | |
NSArray *fillteredArray = [constraintArray filteredArrayUsingPredicate:predicate]; |