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
#import <QuartzCore/QuartzCore.h> | |
@implementation UIView (UIView_RoundCorner) | |
- (void) setCornersRoundedWithRadius: (float) cornerRadius | |
{ | |
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect: self.bounds | |
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
// バックグラウンド処理のスタートを宣言 | |
UIBackgroundTaskIdentifier bgTask = UIBackgroundTaskInvalid; | |
bgTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{ | |
[[UIApplication sharedApplication] endBackgroundTask:bgTask]; | |
}]; | |
/* ここでやりたい処理をする */ | |
// バックグラウンド処理の終了 | |
if (bgTask != UIBackgroundTaskInvalid){ |
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
-UIViewShowAlignmentRects YES |
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
if ([UIApplication sharedApplication].applicationState == UIApplicationStateBackground) ... | |
// UIApplicationStateActive, | |
// UIApplicationStateInactive, |
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 Versioning Preprocessor Macros | |
*/ | |
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame) | |
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending) | |
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) | |
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending) | |
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending) |
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)reloadRow: (NSInteger) row inSection:(NSInteger) section | |
{ | |
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:section]; | |
NSArray *indexPaths = [[NSArray alloc] initWithObject:indexPath]; | |
[self.tableView reloadRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone]; //UITableViewRowAnimationFace or whatever | |
[indexPaths release]; | |
} |
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
NSString *appDomain = [[NSBundle mainBundle] bundleIdentifier]; | |
[[NSUserDefaults standardUserDefaults] removePersistentDomainForName:appDomain]; |
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
NSData *data = UIImageJPEGRepresentation([UIImage imageNamed:@"Flower.jpg"] , 0.5); | |
UIPasteboard* pasteboard = [UIPasteboard pasteboardWithName: LINE_PASTEBOARD create: YES]; | |
[pasteboard setData: data forPasteboardType: (NSString *)kUTTypeJPEG]; | |
// LINE | |
NSString *escapedStr = [LINE_PASTEBOARD stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]; | |
NSString *urlStr = [NSString stringWithFormat:@"line://msg/image/%@", escapedStr]; | |
NSURL *sndUrl = [NSURL URLWithString:urlStr]; | |
if ([[UIApplication sharedApplication] canOpenURL:sndUrl]) { |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
+ (ClassName *)sharedInstance { | |
static dispatch_once_t once; | |
static ClassName *sharedInstance; | |
dispatch_once(&once, ^ { sharedInstance = [[ClassName alloc] init]]; }); | |
return sharedInstance; | |
} | |