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
//getting locaton | |
//1. MyLocations Project Settings | |
//use tab bar controller | |
//import CoreLocation.framework | |
//CurrentLocationViewController.h | |
#import <CoreLocation/CoreLocation.h> |
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
//using UIImagePickerController | |
//TWPhotosCollectionViewController.h | |
@interface TWPhotosCollectionViewController : UICollectionViewController | |
- (IBAction)cameraBarButtonItemPressed:(UIBarButtonItem *)sender; | |
@end |
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
//using custom CollectionViewCell | |
//TWPhotoCollectionViewCell.h | |
@interface TWPhotoCollectionViewCell : UICollectionViewCell | |
@property (strong, nonatomic) UIImageView *imageView; | |
@end |
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
//basic UICollectionView | |
//TWPhotosCollectionViewController.h | |
@interface TWPhotosCollectionViewController : UICollectionViewController | |
@end | |
//TWPhotosCollectionViewController.m |
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
//using coredata helper class and fetchRequest | |
//appDelegate의 NSManagedObjectContext 참조 | |
//TWCoreDataHelper.h | |
@interface TWCoreDataHelper : NSObject | |
+ (NSManagedObjectContext *)managedObjectContext; |
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
//UIAlertView 텍스트 입력 받기 | |
//TWAlbumTableViewController.h | |
@interface TWAlbumTableViewController : UITableViewController | |
@property (strong, nonatomic) NSMutableArray *albums; | |
- (IBAction)addAlbumBarButtonPressed:(UIBarButtonItem *)sender; |
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 7 basic tableview using storyboard with coredata from empty project | |
//TWAppDelegate.h | |
//1. 스토리보드 사용하므로 기본 스텁코드 삭제 | |
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
if (debug==1) {NSLog(@"Running %@ '%@'", self.class, NSStringFromSelector(_cmd));} | |
//스토리보드 사용하므로 기본 스텁코드 삭제 | |
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
//basic Scheduling the local notifications | |
//ChecklistItem.h | |
//principles of Object-Oriented Programming is that objects can do as much as possible themselves | |
//therefore, it makes sense that the ChecklistItem object can schedule its own notifications. | |
- (void)scheduleNotification; | |
//ChecklistItem.m |
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
//basic NSDateFormatter | |
#pragma mark - updateDueDateLabel | |
- (void)updateDueDateLabel { | |
//to convert the NSDate value to text, use the NSDateFormatter object | |
NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; | |
[formatter setDateStyle:NSDateFormatterMediumStyle]; | |
[formatter setTimeStyle:NSDateFormatterShortStyle]; |