Skip to content

Instantly share code, notes, and snippets.

@keicoder
keicoder / Locations.m
Created March 2, 2014 06:32
objective-c : getting locaton
//getting locaton
//1. MyLocations Project Settings
//use tab bar controller
//import CoreLocation.framework
//CurrentLocationViewController.h
#import <CoreLocation/CoreLocation.h>
@keicoder
keicoder / snippet.m
Created February 27, 2014 03:20
objective-c : Image to NSData and Reverse Transform for saving Core Data
//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
@keicoder
keicoder / snippet.m
Created February 26, 2014 06:14
objective-c : using UIImagePickerController
//using UIImagePickerController
//TWPhotosCollectionViewController.h
@interface TWPhotosCollectionViewController : UICollectionViewController
- (IBAction)cameraBarButtonItemPressed:(UIBarButtonItem *)sender;
@end
@keicoder
keicoder / snippet.m
Created February 26, 2014 04:22
objective-c : using custom CollectionViewCell
//using custom CollectionViewCell
//TWPhotoCollectionViewCell.h
@interface TWPhotoCollectionViewCell : UICollectionViewCell
@property (strong, nonatomic) UIImageView *imageView;
@end
@keicoder
keicoder / snippet.m
Created February 26, 2014 03:36
objective-c : basic UICollectionView
//basic UICollectionView
//TWPhotosCollectionViewController.h
@interface TWPhotosCollectionViewController : UICollectionViewController
@end
//TWPhotosCollectionViewController.m
@keicoder
keicoder / snippet.m
Created February 26, 2014 02:28
objective-c : using coredata helper class and fetchRequest
//using coredata helper class and fetchRequest
//appDelegate의 NSManagedObjectContext 참조
//TWCoreDataHelper.h
@interface TWCoreDataHelper : NSObject
+ (NSManagedObjectContext *)managedObjectContext;
@keicoder
keicoder / method.m
Created February 25, 2014 05:21
oobjective-c : UIAlertView 텍스트 입력 받기
//UIAlertView 텍스트 입력 받기
//TWAlbumTableViewController.h
@interface TWAlbumTableViewController : UITableViewController
@property (strong, nonatomic) NSMutableArray *albums;
- (IBAction)addAlbumBarButtonPressed:(UIBarButtonItem *)sender;
@keicoder
keicoder / ios 7 basic tableview using storyboard with coredata from empty project.m
Last active August 29, 2015 13:56
oobjective-c : ios 7 basic tableview using storyboard with coredata from empty project
//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));}
//스토리보드 사용하므로 기본 스텁코드 삭제
@keicoder
keicoder / snippet.m
Created February 24, 2014 09:03
objective-c : basic Scheduling the local notifications
//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
@keicoder
keicoder / snippet.m
Created February 24, 2014 05:31
objective-c : basic NSDateFormatter
//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];