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
//Textkit and TableView with note (ios 7) | |
//1. start with basic dummy data | |
//AppDelegate.h | |
@interface AppDelegate : UIResponder <UIApplicationDelegate> | |
@property (strong, nonatomic) UIWindow *window; | |
@property NSMutableArray* notes; |
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
//Image to NSData and Reverse Transform for saving Core Data | |
//1. CoreData 모델 생성 | |
//ex) Entities name : Photo / Attributes : date (type Date), image (type Transformable) | |
//2. create NSManagedObject Subclass (in this case : TWPictureDataTransformer class) | |
//3. TWPictureDataTransformer.h | |
@interface TWPictureDataTransformer : NSValueTransformer |
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
//snapBehavior example code | |
@implementation DynamicSandwichViewController | |
{ | |
NSMutableArray* _views; | |
UISnapBehavior* _snap; | |
BOOL _viewDocked; | |
} | |
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 animateWithDuration 블록 코드 | |
[UIView animateWithDuration:.2 animations:^{ | |
//code here | |
}]; |
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
//웹 뷰 이용 로컬 html 파일 불러오기 | |
NSString *htmlFile = [[NSBundle mainBundle] | |
pathForResource:@"BullsEye" | |
ofType:@"html"]; | |
NSData *htmlData = [NSData dataWithContentsOfFile:htmlFile]; | |
NSURL *baseURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]]; | |
[self.webView loadData:htmlData MIMEType:@"text/html" textEncodingName:@"UTF-8" baseURL:baseURL]; |
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
//Core Data Lightweight Migration & delete journal mode | |
//1. add a model version | |
//select current xcdatamodel -> Editor > Add Model Version -> accept new version name | |
//2. update data model | |
//select new xcdatamodel -> create a new entity -> select the new entity, create an attribute you want | |
//3. update current model version |
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
//set background image of a UITableView | |
//ViewController.m | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
//Controlling the Background of a UITableView | |
//setting an image as the background of UITableView through four steps | |
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
//iOS Simple TableView | |
//You have to wire up data Source and delegate to the tableView in the xib file | |
//ViewController.h | |
@interface ViewController : UIViewController <UITableViewDataSource, UITableViewDelegate> | |
@property (nonatomic, strong) NSMutableArray *tableData; // holds the table data (title) | |
@property (nonatomic, strong) NSMutableArray *tableDetailData; // holds the table data (detail text) |
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
//make a property read-only to other objects but fully accessible to your own class | |
//.h file | |
//readonly | |
@property (nonatomic, readonly, strong) NSMutableArray *searchResults; | |
//.m file |
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
//파일/디렉토리 삭제 (code snippet that can use to remove any file or folder) | |
- (void)removePhotoFile | |
{ | |
NSString *path = [self photoPath]; | |
NSFileManager *fileManager = [NSFileManager defaultManager]; | |
if ([fileManager fileExistsAtPath:path]) { | |
NSError *error; |
NewerOlder