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
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | |
NSString *filePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"places.plist"]; | |
NSArray *array = @[customObj1, customObj2]; | |
[array writeToFile:[self dataFilePath] atomically: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
// ☆.。.:* CustomObject.h *・°☆*:.. | |
@interface CustomObject : NSObject <NSCoding> // NSCodingプロトコルを利用 | |
NSString *name; | |
NSString *address; | |
@end | |
// ☆.。.:* CustomObject.m *・°☆*:.. | |
// デシリアライズの際に呼ばれる |
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
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | |
NSString *filePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"places.plist"]; | |
// NSKeyedArchiverを使ってNSData型に変換 | |
NSData *data1 = [NSKeyedArchiver archivedDataWithRootObject:customObj1]; | |
NSData *data2 = [NSKeyedArchiver archivedDataWithRootObject:customObj2]; | |
NSArray *array = @[data1, data2]; | |
[array writeToFile:[self dataFilePath] atomically: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
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | |
NSString *filePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"places.plist"]; | |
NSArray *array = [NSArray arrayWithContentsOfFile:filePath]; | |
for (NSData *data in [YSPlaceDataManager loadFromPropertyList]) { | |
// プリパティリストから取り出したNSData型のデータをCustomObject型に再変換 | |
CustomObject *customObj = [NSKeyedUnarchiver unarchiveObjectWithData:data]; | |
NSLog(@"%@", customObj); | |
} |
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 "YMNCoreTextView.h" | |
#import <CoreText/CoreText.h> | |
#import <QuartzCore/QuartzCore.h> | |
@interface YMNCoreTextView() | |
@property (nonatomic, strong) NSMutableAttributedString *attributedString; | |
@end |
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 "YMNCoreTextView.h" | |
#import <CoreText/CoreText.h> | |
#import <QuartzCore/QuartzCore.h> | |
@interface YMNCoreTextView() | |
@property (nonatomic, strong) NSMutableAttributedString *attributedString; | |
@end |
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 "YMNCoreTextView.h" | |
#import <CoreText/CoreText.h> | |
#import <QuartzCore/QuartzCore.h> | |
@interface YMNCoreTextView() | |
@property (nonatomic, strong) NSMutableAttributedString *attributedString; | |
@property (nonatomic, assign) CTFrameRef drawingFrame; | |
@property (nonatomic, assign) NSRange linkableWordRange; |
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
self.imageCropViewController = [[YMNImageCropViewController alloc] initWithImage:image]; | |
self.imageCropViewController.delegate = self; | |
[self presentViewController:self.imageCropViewController animated:NO completion:nil]; |
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)imageCropViewController:(UIViewController* )controller didFinishCroppingImage:(UIImage *)image | |
{ | |
//ここでimageを受け取る | |
} |
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
/// クロップの枠の拡縮の仕方 | |
typedef NS_ENUM(NSUInteger, YMNImageCropMode) { | |
/// 枠のアスペクト比は自由 | |
YMNImageCropModeFlexible, | |
/// 枠のアスペクト比は固定 | |
YMNImageCropModeFixedAspect | |
}; |
OlderNewer