Skip to content

Instantly share code, notes, and snippets.

@edom18
edom18 / file0.m
Created March 5, 2014 15:19
AppleのCore Animationプログラミングガイドを読んだメモ ref: http://qiita.com/edo_m18/items/4309d01b67ee42c35b3c
// `CAEAGLLayer`を返す例
+ (Class) layerClass
{
return [CAEAGLLayer class];
}
@edom18
edom18 / file0.m
Created March 6, 2014 12:22
[Objective-C] UIViewをいい感じに上下左右センタリングする ref: http://qiita.com/edo_m18/items/5dd48b7ee1e6899b8ed5
// ベースのビュー(これをセンタリングする)
UIView *baseView = [[UIView alloc] init];
[baseView addSubview:label];
// アイコンビュー
UIImage image = [UIImage imageNamed:@"hoge"];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
[baseView addSubview:imageView];
@edom18
edom18 / file0.m
Created March 9, 2014 16:26
NSDataの中身を確認する方法 ref: http://qiita.com/edo_m18/items/b39fa31cd5c094fd05b6
NSLog(@"%@", [[NSString alloc] initWithData:data
encoding:NSUTF8StringEncoding]);
@edom18
edom18 / file0.m
Created March 15, 2014 14:12
[Objective-C] UIViewControllerの回転を自力でやる ref: http://qiita.com/edo_m18/items/e312667396f3b49b1dbe
AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
UIWindow *window = nil;
if ([appDelegate respondsToSelector:@selector(window)]) {
window = [appDelegate window];
}
else {
window = [[UIApplication sharedApplication] keyWindow];
}
@edom18
edom18 / file0.m
Created March 17, 2014 14:51
[Objective-C] Swizzling(ランタイムAPI)を使ってDebugをしやすくする ref: http://qiita.com/edo_m18/items/9c57f4714d5c14a990c4
@interface NSString (sample)
- (NSString *)swapLowercaseString;
@end
////////////////////////////////////////
@implementation NSString (sample)
// ViewController.h
@interface SampleViewController : UIViewController <GLKViewDelegate>
{
// 頂点バッファのインデックス保持用インスタンス変数。
// インデックス番号なので`GL uint`型
GLuint vertexBufferID;
}
// ViewController.m
@edom18
edom18 / file0.m
Created March 24, 2014 14:05
[Objective-C] NSDate周りのまとめメモ ref: http://qiita.com/edo_m18/items/5c7c901238e82afac50d
// 今の時間
NSDate *now = [NSDate date];
// 今から3秒後
NSDate *after3 = [NSDate dateWithTimeIntervalSinceNow:3.0];
@edom18
edom18 / file0.m
Created March 28, 2014 13:25
[Objective-C] タップによるズーム機能の実装メモ ref: http://qiita.com/edo_m18/items/9400bf8fa37ceb7077d7
@protocol TapDetectingViewDelegate;
@interface SMPView : UIView
@property (assign, nonatmic) id<TapDetectingViewDelegate> delegate;
@end
@protocol TapDetectingViewDelegate <NSObject>
@edom18
edom18 / file0.m
Created April 1, 2014 16:23
[Objective-C] GCDについての備忘録 ref: http://qiita.com/edo_m18/items/2f8c6bde4492ef116ed0
dispatch_queue_t queue = dispatch_queue_create("com.hoge.queue", [attribute]);
@edom18
edom18 / file0.m
Created April 3, 2014 05:14
NSOperationを使って並列処理をするシンプルなサンプル ref: http://qiita.com/edo_m18/items/c121d0cb42a6e20cefbd
// NOTOperation.m
@interface NOTOperation ()
@property (assign, nonatomic) BOOL isFinished;
@property (assign, nonatomic) BOOL isExecuting;
@end