본문 바로가기

Programming/iPhone, Xcode

iOS - Single View Application with Core Data setting in XCode 4.5 Here is I have learned from scratch. 1. Create Single View Application in Xcode project from File -> New -> Project 2. Add Core Data framework. 3. Add below codes to myproject_Prefix.pch#import 4. Add following codes to AppDelegate.h file. @property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext; @property (readonly, strong, nonatomic) NSManagedObjectModel *managedObj.. 더보기
iOS - App file system structure Apple 개발자 글에 링크가 있다. https://developer.apple.com/library/ios/#documentation/FileManagement/Conceptual/FileSystemProgrammingGUide/FileSystemOverview/FileSystemOverview.html#//apple_ref/doc/uid/TP40010672-CH2-SW2 더보기
iOS - 테이블뷰셀 사용자 정의하기 (TableViewCell customize) 테이블뷰셀을 사용자가 정의하여 사용할 수 있다. 아래 링크에 이에 대한 좋은 글이 있다. http://agilewarrior.wordpress.com/2012/05/19/how-to-add-a-custom-uitableviewcell-to-a-xib-file-objective-c/ 더보기
iOS - iPhone 에 있는 파일들의 경로를 읽어 오기 iPhone 에 파일이름은 같은데, 경로가 다른 파일들을 저장할 수 있다. 예를 들면 아래와 같은 경우,dir1/sea.jpgdir2/sea.jpgdir3/dir5/sea.jpg 이럴 경우에 파일의 경로를 얻어오는 방법이 있다. 아래와 같이 파일 이름을 얻어 올때, 디렉토리를 지정하여 얻어오는 방법이 있다.NSBundle *bundle = [NSBundle bundleForClass:[self class]]; NSString *filePath = nil; if (filePath = [bundle pathForResource:@"sea" ofType:@"jpg" inDirectory:@"dir1"]) { theContents = [[NSString alloc] initWithContentsOfFile:fi.. 더보기
iOS - UIWebView 에 back button 기능 구현 UIWebView 를 View Controller 에 추가하게 되면, 우리가 사용하는 모바일 Safari 브라우저처럼 back button 이 제공되지 않는다. 이를 stack 을 이용하여 실제로 구현하려고 하면 머리가 아픈데, 이미 이런 기능이 있지 않을까 라고 생각 했는데, 이미 있었다. :) UIWebView Class Reference 를 살펴보면 아래와 같은 Instance method 를 발견 할 수 있다. goBack Loads the previous location in the back-forward list. - (void)goBack Availability Available in iOS 2.0 and later. 실제로 back button 을 이용하여 back 기능을 구현하려면 UIW.. 더보기
iOS - Core Data relation tutorial iOS 의 Core Data 에서 relation 의 개념을 명쾌하게 설명한 글을 발견하였다. :) Core Data on iOS 5 Tutorial: How To Work with Relations and Predicateshttp://www.raywenderlich.com/14742/core-data-on-ios-5-tutorial-how-to-work-with-relations-and-predicates 더보기
iOS - Core Data Tutorial 추천 iOS 에서 Core Data 참고자료가 필요하여 여러 글들을 읽어 본 결과 아래의 사이트에서 제공하는 tutorial 이 꽤 괜찮은 거 같아서 링크를 남긴다. Core Data on iOS 5 Tutorial: Getting Startedhttp://www.raywenderlich.com/934/core-data-on-ios-5-tutorial-getting-started 더보기
iOS - Core Data attribute types iOS 에서 Core Data 를 사용할 때, attribute 들의 type 들이 각각 무슨의미인 지 궁금 했다. Integer 16, Integer 32, and Integer 64 data types are for storing signed integers. The range of values that these types are able to store is as follows:Integer 16:-32,768 to 32, 767Integer 32:-2,147,483,648 to 2,147,483,647Integer 64:-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807Decimal, Double, and Float data types are fo.. 더보기
iOS Core Data - About primary key iPhone 에서 Core Data 를 이용하여 개발할 경우, 일반적인 Database 에서 사용하는 primary key 에 대해서 고민할 필요가 없다. Core Data 에서는 생성되는 object 들에 대해서 id 를 자동으로 만들어 주는 일을 한다. 그러므로, 아래와 같이 해당 object 에 대한 id 를 얻어올 수 있다.NSManagedObjectID *moID = [managedObject objectID]; 더보기
NSFetchedResultController 가 Core Data 에 업데이트 혹은 추가 된 객체를 재대로 인식하게 하는 법 간혹 NSFetechedResultController 가 Core Data 에서 업데이트 되거나 추가된 객체를 재대로 반영하지 못할 경우가 있다. 이럴 경우에는 아래와 같은 코드를 추가해 주자. - (void)controllerDidChangeContent:(NSFetchedResultsController *)controller { [self.tableView reloadData]; // AddItemViewController 에서 추가한 Item 의 check index 가 제대로 반영되기 위해서 tableView 를 reload 한다. } 더보기