Skip to content

Instantly share code, notes, and snippets.

@keicoder
keicoder / snippet.m
Created January 10, 2014 02:09
objective-c : 다큐먼트 디렉토리 로그로 찍어보기
//다큐먼트 디렉토리 로그로 찍어보기
NSArray *searchPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentPath = [searchPaths objectAtIndex:0];
NSLog(@"다큐먼트 디렉토리 : %@", documentPath);
@keicoder
keicoder / snippet.m
Created January 10, 2014 02:24
objective-c : handy tool for troubleshooting Core Data using X-Code scheme
// handy tool for troubleshooting Core Data using X-Code scheme
1. select project file in X-Code
2. choose Edit Scheme... from the menu
3. Click the “Run yourapp.app” option
4. In the Arguments Passed On Launch section, add the following : -com.apple.CoreData.SQLDebug 1
5. Press OK and run the app
// Now you see lot's of information in the Debug Area
@keicoder
keicoder / snippet.m
Created January 14, 2014 02:56
objective-c : 파일/디렉토리 삭제 (code snippet that can use to remove any file or folder)
//파일/디렉토리 삭제 (code snippet that can use to remove any file or folder)
- (void)removePhotoFile
{
NSString *path = [self photoPath];
NSFileManager *fileManager = [NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:path]) {
NSError *error;
@keicoder
keicoder / snippet.m
Created January 14, 2014 04:23
objective-c : NSString category addRandomWord
//NSString category : addRandomWord
//for example :
//NSString+RandomWord.h
@interface NSString (RandomWord)
- (NSString *)addRandomWord;
@keicoder
keicoder / snippet.m
Created January 14, 2014 05:26
objective-c : UIImage+Resize 카테고리
//UIImage+Resize 카테고리
//UIImage+Resize.h
@interface UIImage (Resize)
- (UIImage *)resizedImageWithBounds:(CGSize)bounds;
@end
@keicoder
keicoder / iOS system font.m
Last active January 3, 2016 10:59
objective-c : iOS 시스템 폰트
//iOS 시스템 폰트
for (NSString* s in [UIFont familyNames])
NSLog(@"%@: %@", s, [UIFont fontNamesForFamilyName:s]);
2014-01-16 20:27:47.509 StoreSearch[856:60b]() Thonburi: (
"Thonburi-Bold",
@keicoder
keicoder / snippet.m
Created January 16, 2014 11:45
objective-c : iOS 7 Dynamic Type font Text Styles
iOS 7 Dynamic Type font Text Styles
These constants provide semantic descriptions of the intended use for a font returned by the UIFont class method preferredFontForTextStyle: or a font descriptor returned by preferredFontDescriptorWithTextStyle:.
NSString *const UIFontTextStyleHeadline;
NSString *const UIFontTextStyleSubheadline;
NSString *const UIFontTextStyleBody;
NSString *const UIFontTextStyleFootnote;
NSString *const UIFontTextStyleCaption1;
NSString *const UIFontTextStyleCaption2;
@keicoder
keicoder / snippet.m
Last active January 3, 2016 11:09
objective-c : iOS 7 Dynamic Type Font Test
//iOS 7 Dynamic Type Font Test
//In this example, we have a label (self.lab) whose font uses Dynamic Type;
//we set its font both when the label first appears in the interface and subsequently
//whenever UIContentSizeCategoryDidChangeNotification arrives:
- (void)viewDidLoad {
[super viewDidLoad];
[self doDynamicType:nil];
@keicoder
keicoder / snippet.m
Created January 16, 2014 12:34
objective-c : iTunes Search Terms (HTTP request)
//iTunes Search Terms (HTTP request)
//http://itunes.apple.com/search?term=the search term
http://itunes.apple.com/search?term=metallica
//make the search more specific
http://itunes.apple.com/search?term=metallica&entity=song
//If the search term has a space in it, replace it with a + sign
@keicoder
keicoder / snippet.m
Created January 22, 2014 04:51
objective-c : make imbeded view (임베디드 뷰 만들기)
//make imbeded view (임베디드 뷰 만들기)
//1. add a new file to the project. name it new file (in this case LandscapeViewController). make sub- class of UIViewController and make XIB also
//2. select the nib, change its Orientation (in the Attributes Inspector), change the Background Color if you want
//3. disable Auto Layout for the nib if you want
//4. drag a new Label into the nib and give it some text (just for test)
//in a parent view (in this case SearchViewController)