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)gotoPrevChar | |
{ | |
UITextRange *selectedRange = [self.noteTextView selectedTextRange]; | |
//Calculate the new position, - for left and + for right | |
if (self.noteTextView.selectedRange.location > 0) { | |
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
Online Dev Tutorial Site | |
video2brain https://www.video2brain.com | |
tutsplus https://tutsplus.com | |
lynda http://www.lynda.com | |
pluralsight http://pluralsight.com | |
Infinite Skills http://www.infiniteskills.com | |
udemy https://www.udemy.com | |
teamtreehouse http://teamtreehouse.com |
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
UiTableView Deleting rows (테이블 뷰 행 삭제) | |
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
[items removeObjectAtIndex:indexPath.row]; //1. remove the item from data model: | |
NSArray *indexPaths = [NSArray arrayWithObject:indexPath]; | |
[tableView deleteRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationAutomatic]; //2. delete the corresponding row from the table view | |
} |
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
UiTableView Static cell disable selections for row (정적 셀에서 셀 선택 허용하지 않기) | |
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
return nil; //returning nil, delegate answers : “Sorry, but you’re not allowed to!” | |
} | |
* One more thing todo : Storyboard editor, select the table view cell and go to the Attributes Inspector. Set the Selection attribute to None. | |
now impossible to select the row and make it turn blue. |
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
UITextField 텍스트 유무에 따라 액션 버튼 활성화 판단 | |
- (BOOL)textField:(UITextField *)theTextField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string | |
{ | |
NSString *newText = [theTextField.text stringByReplacingCharactersInRange:range withString:string]; | |
if ([newText length] > 0) { | |
self.doneBarButton.enabled = YES; | |
} else { | |
self.doneBarButton.enabled = NO; | |
} |
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
기본적인 delegate pattern | |
//steps for setting up the delegate pattern between two objects, | |
//where object A is the delegate for object B and object B will send out the messages: | |
//1.Define a delegate @protocol for object B. | |
//2.Give object B a property for that delegate protocol. | |
//3.Make object B send messages to its delegate when something interesting happens, such as the user pressing the Cancel or Done buttons, or when it needs a piece of information. | |
//4.Make object A conform to the delegate protocol. It should put the name of the protocol in its @interface line and implement the methods from the protocol. | |
//5.Tell object B that object A is now its delegate. |
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
put check mark on UITableView Cell (테이블 뷰에 체크마크 넣기) | |
//first : | |
//Add a new label to the cell to the left of the text label. Give it the following attributes: | |
//Text: √ (you can type this with Alt/Option+V) • Font: System Bold, size 22 | |
//Autoshrink: No | |
//Highlighted color: White | |
//Tag: 1001 //give label its own tag, so can easily find it later. | |
- (void)configureCheckmarkForCell:(UITableViewCell *)cell withChecklistItem:(ê ChecklistItem *)item { |
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
UITableView Cell의 Detail Disclosure 버튼에 Segue 적용 (for iOS 5) | |
//Note: As of Xcode 4.5 and iOS 6 you can now make segues directly from accessory buttons. | |
//When you Ctrl-drag from the table view cell, | |
//Xcode asks you whether you want to put the segue on the whole cell or just the accessory button. | |
//this new feature is not compatible with iOS 5 | |
//first : | |
//table view cell in the Storyboard editor and in the Attributes Inspector set its Accessory to Detail Disclosure. | |
//Ctrl-drag from the ChecklistsViewController icon in the dock area to the Navigation Controller and make a Modal segue: |
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
UITextView 생성, 델리게이트 메소드 | |
#import <QuartzCore/QuartzCore.h> | |
.h 파일 | |
@interface 에서 <UITextViewDelegate> 명시 | |
.m 파일 | |
#pragma mark - 뷰 라이프 사이클 |