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
//Core Data : enable SQL Debug mode and disable journaling mode (WorksWellOnIOS7) | |
//enable SQL Debug mode | |
//1. Product > Scheme > Edit Scheme ... | |
//2. Ensure Run (Your App) and the Arguments tab is selected |
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
//sample code | |
//CoreData : fetchRequest, sortDescriptor, filter using predicate, show resulting Array object using for loop | |
- (void)demo { | |
if (debug==1) {NSLog(@"Running %@ '%@'", self.class, NSStringFromSelector(_cmd));} | |
//데모 데이터 | |
// NSArray *newItemNames = [NSArray arrayWithObjects: | |
// @"Apples", @"Milk", @"Bread", @"Cheese", @"Sausages", @"Butter", @"Orange Juice", @"Cereal", @"Coffee", @"Eggs", @"Tomatoes", @"Fish", 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
//Core Data Default Migration | |
//1. disable automatic model mapping (just recommended option) | |
//set the NSInferMappingModelAutomaticallyOption option to @NO | |
NSDictionary *options = @{NSMigratePersistentStoresAutomaticallyOption:@YES, | |
NSInferMappingModelAutomaticallyOption:@NO, | |
NSSQLitePragmasOption: @{@"journal_mode": @"DELETE"}}; | |
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
//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 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 불러오기 | |
//present View Controller Modally | |
- (IBAction)addBookmark:(id)sender { | |
// Initialize Add Bookmark View Controller | |
AddBookmarkViewController *vc = [[AddBookmarkViewController alloc] initWithNibName:@"AddBookmarkViewController" bundle:[NSBundle mainBundle]]; | |
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
//클래스 생성 및 메소드 구현 예제 | |
//.h 파일 | |
@interface Player : NSObject { | |
//ivar | |
int score; | |
NSString *name; | |
} |
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
//웹 뷰 이용 로컬 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 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 7 상태바 감추기 (remove the status bar on iOS 7) | |
//1. Main.storyboard -> View Controller -> Attributes inspector -> Simulated Metrics -> set Status Bar to None | |
//2. To remove the status bar during runtime, change necessary code | |
//.m file | |
- (BOOL)prefersStatusBarHidden { | |
return 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
//테이블 뷰 레이블 (not embeded lable) tag 설정 | |
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ChecklistItem"]; | |
//tag 값으로 지정하기 | |
UILabel *label = (UILabel *)[cell viewWithTag:1000]; | |
if (indexPath.row == 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
//코어 애니메이션 (Crossfade) 예제 | |
CATransition *transition = [CATransition animation]; | |
transition.type = kCATransitionFade; | |
transition.duration = 1; | |
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; |
OlderNewer