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
| //iOS Internationalization using NSLocalizedString() | |
| //1. use NSLocalizedString() (even if you don’t care about internationalization right away) | |
| //2. open a Terminal, go into the folder that contains the actual source files | |
| //3. type command :genstrings *.m -o en.lproj | |
| //4. above command add a new file called Localizable.strings in the en.lproj folder | |
| //5. add Localizable.strings file to the project in Xcode (ex : Supporting Files group) | |
| //6. in the File Inspector, add a localization for this file (in this case Dutch) | |
| //7. Change the translations in the Localizable.strings |
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
| //Adding a Background Image using backgroundColor property | |
| - (void)viewDidLoad { | |
| [super viewDidLoad]; | |
| //make a “color” based on an image using backgroundColor property | |
| self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"bg_img"]]; | |
| } |
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
| //UIKit Customization | |
| //.h | |
| - (void)customizeAppearance; | |
| //.m | |
| - (void)customizeAppearance | |
| { |
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
| //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
| //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 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
| //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 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
| //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"}}; | |