This file contains 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
- (void)viewWillAppear:(BOOL)animated | |
{ | |
[super viewWillAppear:animated]; | |
//키보드 옵저버 | |
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidShow:) | |
name:UIKeyboardDidShowNotification object:self.view.window]; | |
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) | |
name:UIKeyboardWillHideNotification object:self.view.window]; |
This file contains 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 스토리보드 대신 xib 방식으로 개발하기 | |
//solution 1 | |
1. empty application 생성 | |
2. new class file 생성 -> name : ViewController, UIViewController sub class, with XIB check | |
3. appdelegate 헤더 파일 수정 | |
@class ViewController; | |
@property (strong, nonatomic) ViewController *viewController; | |
4. appdelegate m 파일 수정 |
This file contains 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
//파일/디렉토리 삭제 (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; |
This file contains 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 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 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 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 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
//웹 뷰 이용 로컬 html 파일 불러오기 | |
NSString *htmlFile = [[NSBundle mainBundle] | |
pathForResource:@"BullsEye" | |
ofType:@"html"]; | |
NSData *htmlData = [NSData dataWithContentsOfFile:htmlFile]; | |
NSURL *baseURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]]; | |
[self.webView loadData:htmlData MIMEType:@"text/html" textEncodingName:@"UTF-8" baseURL:baseURL]; |
This file contains 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
//UIView animateWithDuration 블록 코드 | |
[UIView animateWithDuration:.2 animations:^{ | |
//code here | |
}]; |
This file contains 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
//snapBehavior example code | |
@implementation DynamicSandwichViewController | |
{ | |
NSMutableArray* _views; | |
UISnapBehavior* _snap; | |
BOOL _viewDocked; | |
} | |
OlderNewer