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
// `CAEAGLLayer`を返す例 | |
+ (Class) layerClass | |
{ | |
return [CAEAGLLayer class]; | |
} |
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
// ベースのビュー(これをセンタリングする) | |
UIView *baseView = [[UIView alloc] init]; | |
[baseView addSubview:label]; | |
// アイコンビュー | |
UIImage image = [UIImage imageNamed:@"hoge"]; | |
UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; | |
[baseView addSubview:imageView]; |
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
NSLog(@"%@", [[NSString alloc] initWithData:data | |
encoding:NSUTF8StringEncoding]); |
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
AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate]; | |
UIWindow *window = nil; | |
if ([appDelegate respondsToSelector:@selector(window)]) { | |
window = [appDelegate window]; | |
} | |
else { | |
window = [[UIApplication sharedApplication] keyWindow]; | |
} |
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
@interface NSString (sample) | |
- (NSString *)swapLowercaseString; | |
@end | |
//////////////////////////////////////// | |
@implementation NSString (sample) |
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
// ViewController.h | |
@interface SampleViewController : UIViewController <GLKViewDelegate> | |
{ | |
// 頂点バッファのインデックス保持用インスタンス変数。 | |
// インデックス番号なので`GL uint`型 | |
GLuint vertexBufferID; | |
} | |
// ViewController.m |
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
// 今の時間 | |
NSDate *now = [NSDate date]; | |
// 今から3秒後 | |
NSDate *after3 = [NSDate dateWithTimeIntervalSinceNow:3.0]; |
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
@protocol TapDetectingViewDelegate; | |
@interface SMPView : UIView | |
@property (assign, nonatmic) id<TapDetectingViewDelegate> delegate; | |
@end | |
@protocol TapDetectingViewDelegate <NSObject> |
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
dispatch_queue_t queue = dispatch_queue_create("com.hoge.queue", [attribute]); |
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
// NOTOperation.m | |
@interface NOTOperation () | |
@property (assign, nonatomic) BOOL isFinished; | |
@property (assign, nonatomic) BOOL isExecuting; | |
@end |