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
- (BOOL)createDestinationInstancesForSourceInstance:(NSManagedObject *)sInstance entityMapping:(NSEntityMapping *)mapping manager:(NSMigrationManager *)manager error:(NSError **)error | |
{ | |
NSManagedObjectContext *context = [manager destinationContext]; | |
NSString *entityName [mapping destinationEntityName]; | |
NSManagedObject *dInstance = [NSEntityDescription insertNewObjectForEntityForName:entityName inManagedObjectContext:context]; | |
[dInstance setValue:@"value1" forKey:@"anyKey1"]; | |
[dInstance setValue:@"value2" forKey:@"anyKey2"]; | |
//… |
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
//レイヤーを新規作成 | |
CALayer *sublayer = [CALayer layer]; | |
sublayer.backgroundColor = [UIColor blueColor].CGColor; | |
sublayer.shadowOffset = CGSizeMake(0, 3); | |
sublayer.shadowRadius = 5.0; | |
sublayer.shadowColor = [UIColor blackColor].CGColor; | |
sublayer.shadowOpacity = 0.8; | |
sublayer.frame = CGRectMake(30, 30, 120, 150); | |
sublayer.borderColor = [UIColor blackColor].CGColor; | |
sublayer.borderWidth = 2.0; |
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 <Accelerate/Accelerate.h> | |
#import <AVFoundation/AVFoundation.h> |
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 (^blk)(void) { NSLog(@"in block"); }; |
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
UIView *view1 = [[UIView alloc] initWithFrame:self.view.bounds]; | |
view1.backgroundColor = [UIColor redColor]; | |
UIView *view2 = [[UIView alloc] initWithFrame:self.view.bounds]; | |
view2.backgroundColor = [UIColor blueColor]; | |
[self.view addSubview:view1]; | |
[self.view addSubview:view2]; | |
// 追加と同時に行うとアニメーションしないので、サンプルでは処理をちょっとだけ遅延させています |
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
// `CAEAGLLayer`を返す例 | |
+ (Class) layerClass | |
{ | |
return [CAEAGLLayer class]; | |
} |
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
// ベースのビュー(これをセンタリングする) | |
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 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 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 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) |
OlderNewer