외규장각 도서 환수 모금 캠페인

'Interesting/objective - C'에 해당되는 글 48건

  1. 2012.04.25 How To xml parser
  2. 2012.04.25 NSString <-> NSData
  3. 2012.03.12 Xcode Debug 시에만 NSLog 출력
  4. 2012.03.12 Xocde 암호화(AES256 + base64)
  5. 2011.01.11 정적 라이브러리 생성
  6. 2011.01.04 IB없이 코딩하기 #1
  7. 2010.12.14 Info-pList 파일
  8. 2010.10.28 MacBook Shortcuts
  9. 2010.10.27 XCode 단축키
  10. 2010.08.05 Xcode UITable delegate & dataSource

NSXMLParser *parser = [[NSXMLParser alloc] initWithData:[xml dataUsingEncoding:NSUTF8StringEncoding]];

[parser setDelegate:self];

[parser parse];

[parser release];


- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict

{

    // Start 태그를 만났을 때

}


- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName

{

    // End 태그를 만났을 때

}


- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string

{

// 값을 찾았을 때

}

Posted by 닉네임영역
,

NSString *str = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];

NSData *data = [str dataUsingEncoding:NSUTF8StringEncoding];

Posted by 닉네임영역
,
Xcode 4.2 기준

1. DEBUG 추가
PROJECT > Build Settings > Apple LLVM compiler 3.0 - Preprocessing
Preprocessor Macros > Debug 에 DEBUG 입력

2. NSLog 출력 방식 변경
<프로젝트명>_Prefix.pch의 맨 밑에

#ifdef DEBUG
#define NSLog( s, ...) NSLog( @"<%p %@: (%d)> %@", self, [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__. [NSString stringWithFormat:(s), ##__VA__ARGS__] )
#else
#define NSLog( s, ...)
#endif

3. 출력형태
파일명 라인번호 출력값
Posted by 닉네임영역
,


암호화 방법
 : 원본 스트링 -> AES256 인코딩 -> base64 인코딩 -> 암호화된 스트링

복호화 방법
 : 암호화된 스트링 -> base64 디코딩 -> AES256 디코딩 -> 원본 스트링

example)
#import "NSString+Encrypt.h"

NSString *str = @"암호화 할 문자열";
NSLog(@"암호화 : %@", [str encryptWithKey:@"암호화 할때 사용할 문자열]);
NSLog(@"복원 : %@", [[str encryptWithKey:@"암호화 때 사용한 문자열"] decryptWithKey:@"key"]);

Posted by 닉네임영역
,

1. template > Library > Cocoa Touch Static Library -> naming

2. Groups & Files 에 "xxx.a" Productsdhk "xxx" Targets 이 생성된 것 확인 

3. 코딩 후 Targets의 "xxx"를 선택하고 우측 상단의 파일 목록에서 "xxx.h"를 선택하여  Role 항목의 값을 public 으로 변경.

Posted by 닉네임영역
,

UILabel *idLabel = [[UILabel alloc] initWithFrame:CGRectMake(50.0, 50.0, 50.0, 30.0)];

idLabel.text = @"ID"

[idLabel setBackgroundColor:[UIColor clearColor]];

idLabel.textAlignment = UITextAlignmentCenter;

UILabel *pwLabel = [[UILabel alloc] initWithFrame:CGRectMake(50.0, 90.0, 50.0, 30.0)];

pwLabel.text = @"PW"

[pwLabel setBackgroundColor:[UIColor clearColor]];

pwLabel.textAlignment = UITextAlignmentCenter;

UITextField *idTextField = [[UITextField alloc] initWithFrame:CGRectMake(110.0, 50.0, 100.0, 30.0)];

idTextField.borderStyle = UIButtonTypeRoundedRect;

idTextField.returnKeyType = UIReturnKeyDone;

idTextField.delegate = self;

[idTextField addTarget:self action:@selector(EndEditing:) forControlEvents:UIControlEventEditingDidEndOnExit];

UITextField *pwTextField = [[UITextField alloc] initWithFrame:CGRectMake(110.0, 90.0, 100.0, 30.0)];

pwTextField.returnKeyType = UIReturnKeyDone;

pwTextField.borderStyle = UIButtonTypeRoundedRect;

pwTextField.delegate = self;

[pwTextField addTarget:self action:@selector(EndEditing:) forControlEvents:UIControlEventEditingDidEndOnExit];


UIButton *cancelButton = [self CreateButton:@"Cancel" type:UIButtonTypeRoundedRectview:self.view 

frame:CGRectMake(50.0130.075.030.0target:self action:nil];

UIButton *confirmButton = [self CreateButton:@"Confirm" type:UIButtonTypeRoundedRectview:self.view 

frame:CGRectMake(135.0130.075.030.0target:self action:nil];

[self.view addSubview:idLabel];

[self.view addSubview:pwLabel];

[self.view addSubview:idTextField];

[self.view addSubview:pwTextField];

        [self.view addSubview:cancelButton];

[self.view addSubview:confirmButton];



--------------------------------------------------------------------------------------------





- (void)EndEditing:(id)sender

{

[sender resignFirstResponder];

}


- (UIButton *)CreateButton:(NSString *)title type:(UIButtonType)type view:(UIView *)view 

frame:(CGRect)frame target:(id)target action:(SEL)action {

UIButton *button = [[UIButton buttonWithType:type] retain];

button.frame = frame;

[button setTitle:title forState:UIControlStateNormal];

[button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];

[view addSubview:button];

return button;

}

Posted by 닉네임영역
,
Application requires iPhone environment : 실행 가능한 아이폰 환경
Application users Wi-Fi : Wi-Fi 사용여부
Bundle creator OS Type code : 애플리케이션 개발자의 OS 코드
Bundle display name : 애플리케이션 아이콘에 나타나는 이름
Bundle identifier : 애플리케이션의 고유 식별자
Bundle name : 애플리케이션의 실제 이름
Bundle OS Type code : 애플리케이션 실행 OS 코드
Bundle version : 애플리케이션의 버전
Bundle version string. short : 구체적인 애플리케이션의 버전
Executable architectures : -
Executable file : 실행 가능한 파일
Get Info string : -
Icon already includes gloss and bevel effects : 아이콘 표시 효과 설정
Icon file : 아이콘 파일
Initial interface orientation : 기본 화면의 가로/세로형 설정
Localization native development region : -
Localized resources can be mixed : -
Main nib file base name : 기본 nib 파일
Renders with edge antialisasing : 안티앨리어싱 사용 설정
Renders with group opacity : 투명도 사용 설정
Required device capabilities : 사용가능한 장치를 설정
Status bar is initially hidden : 상태바를 표시 설정
Status bar style : 상태바 스타일 설정
Supported external accessory protocols : 확장 프로토콜 사용 설정
Upgrade other bundle identifier : 업그레이드를 위한 식별자
URL types : 커스텀 URL 사용 설정

애플리케이션의 기본정보는 자신의 개발하고 있는 프로젝트 상황에 맞추어 설정하도록 한다. 특히 'Required device capabilities' 의 항목은 다음과 같다.

telephony : 전화 통화가 가능해야 한다.
sms : 문자 기능을 필요하다.
still-camera : 카메라 장치가 있어야 한다.
auto-focus-camera : 자동 초점 기능을 사용해야 한다.
video-camera : 비디오 녹화가 가능해야 한다.
wifi : WiFi 를 사용해야 한다.
accelerometer : 가속도계를 사용한다.
location-services : 현재 위치를 제공하는 위치 서비스를 사용한다.
gps : GPS 기능을 사용한다.
magnetometer : 나침반 기능을 사용한다.
microphone : 마이크를 사용한다.
opengles-1 : OpenGL ES 1.1 을 사용한다.
opengles-2 : OpenGL ES 2.0 을 사용한다.
Posted by 닉네임영역
,
Cmd-A Select All
Cmd-B Was Show/Hide Bookmarks Bar in older Safaris
Cmd-C Copy
Cmd-D Add Bookmark...
Cmd-E Use Selection for Find
Cmd-F Find...
Cmd-G Find Next
Cmd-H Hide Safari
Cmd-I
Cmd-J Jump to Selection
Cmd-K Used to be Block Pop-up Windows, changed because people were hitting it accidentally too often
Cmd-L Open Location...
Cmd-M Minimize
Cmd-N New Window
Cmd-O Open File...
Cmd-P Print...
Cmd-Q Quit Safari
Cmd-R Reload Page
Cmd-S Save As...
Cmd-T New Tab
Cmd-U
Cmd-V Paste
Cmd-W Close Window or Close Tab Close Tab if multiple tabs are showing, otherwise Close Window
Cmd-X Cut
Cmd-Y
Cmd-Z Undo
Cmd-Shift-A AutoFill Form
Cmd-Shift-B Show/Hide Bookmarks Bar Safari-152 and earlier used Cmd-B for this
Cmd-Shift-C
Cmd-Shift-D Add Bookmark to Menu Alternate menu item to Add Bookmark...
Cmd-Shift-E
Cmd-Shift-F Hide Find Banner
Cmd-Shift-G Find Previous
Cmd-Shift-H Home Cmd-Home also does this
Cmd-Shift-I
Cmd-Shift-J
Cmd-Shift-K Block Pop-up Windows Used to be Cmd-K, changed because people were hitting it accidentally too often
Cmd-Shift-L
Cmd-Shift-M
Cmd-Shift-N Add Bookmark Folder
Cmd-Shift-O
Cmd-Shift-P Page Setup...
Cmd-Shift-Q
Cmd-Shift-R Force Repaint in Debug menu
Cmd-Shift-S Save As... Same behavior as Cmd-S, present for UI compatibility
Cmd-Shift-T
Cmd-Shift-U
Cmd-Shift-V
Cmd-Shift-W Close Window only if multiple tabs are showing
Cmd-Shift-X
Cmd-Shift-Y
Cmd-Shift-Z Redo
Cmd-Option-A Activity
Cmd-Option-B Show All Bookmarks
Cmd-Option-C Show Error Console when the Develop menu is enabled
Cmd-Option-D Show/Hide Dock (System-wide)
Cmd-Option-E Empty Cache...
Cmd-Option-F Google Search...
Cmd-Option-G
Cmd-Option-H Hide Others
Cmd-Option-I Show Web Inspector when the Develop menu is enabled
Cmd-Option-J
Cmd-Option-K
Cmd-Option-L Downloads Cmd-Option-D is more natural, but used by the Dock
Cmd-Option-M Minimize All Alternate menu item to Minimize
Cmd-Option-N Show Network Timeline when the Develop menu is enabled
Cmd-Option-O
Cmd-Option-P
Cmd-Option-Q
Cmd-Option-R
Cmd-Option-S Search Results SnapBack
Cmd-Option-T Special Characters...
Cmd-Option-U View Source Changed in Tiger to match "View Raw Source" in Mail
Cmd-Option-V
Cmd-Option-W Close All Windows when Cmd-W is Close Window (Alternate menu item)
Cmd-Option-X
Cmd-Option-Y
Cmd-Option-Z
Cmd-Option-Shift-P Start Profiling JavaScript when the Develop menu is enabled
Cmd-Option-Shift-V Paste and Match Style keyboard equivalent matches Mail
Cmd-Option-Shift-W Close All Windows when Cmd-Shift-W is Close Window (Alternate menu item)
Cmd-1 to Cmd-9 first 9 bookmarks (not folders) in Bookmarks Toolbar
Cmd-Shift-1 Show Top Sites
Cmd-? Safari Help
Cmd-[ Back
Cmd-] Forward
Cmd-. Stop
Cmd-, Preferences...
Cmd-/ Show/Hide Status Bar
Cmd-| Show/Hide Toolbar
Cmd-\ Show Page Load Test Window in Debug menu
Control-Tab Select Next Tab
Control-Shift-Tab Select Previous Tab
Posted by 닉네임영역
,


■에디터에서 .h와 .m 파일 전환(토글)
⌘⌥⇡

■편집 위치 히스토리 전환
⌘⌥⇠
⌘⌥⇢

■정의로 이동(Jump to Definition), 인터페이스 빌더에서 소스코드로 이동도 가능
⌘ double-click

■레퍼런스 문서의 심볼 도움말로 이동 (기본 문서에만 적용)
⌘⇧D
⌥ double-click

■코드창 확장/축소 토글
⌘⇧E

■코드 컴플리션 (각각 범위가 다름)
Esc
Tab

■파일/멤버/심볼 등의 목록 팝업
⌃1
⌃2
⌃3

■주석 표시 (멤버 목록에 하이라이트됨)
// TODO:
// FIXME:
// !!!:
// ???:

■코드창 나누기 버튼을 클릭할 때 옵션을 누르고 있으면 가로로 나눠짐
⌥ click

■선택한 텍스트 영역의 탭 인덴트/언인덴트
⌘[
⌘]

■간결한 클래스 정의 명세 및 헬프 브라우저
Project > Class Browser
⌘⇧C

■⌘ (Command key) – Sometimes called “Apple key”()
■⌃ (Control key)
■⌥ (Option key) – “Alt” may also appear on this key
■⇧ (Shift key)
■⇪ (Caps Lock)
■fn (Function key)

Posted by 닉네임영역
,

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

//셀 갯수 

 //controllers = NSArray

 return [self.controllers count];

}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

static NSString *FirstLevelCell = @"FirstLevelCell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:FirstLevelCell];

if(cell == nil) {

cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:FirstLevelCell] autorelease];

}

NSInteger row = [indexPath row];

SecondLevelViewController *controller = [controllers objectAtIndex:row];

cell.textLabel.text = controller.titie;

cell.imageView.image = controller.rowImage;

cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

return cell;

}


#pragma mark -

#pragma mark Table View Delegate Methods


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

NSInteger row = [indexPath row];

SecondLevelViewController *nextController = [self.controllers objectAtIndex:row];

[self.navigationController pushViewController:nextController animated:YES];

}

Posted by 닉네임영역
,


사랑합니다. 편안히 잠드소서