'iOS & Mac'에 해당되는 글 9건

  1. 2011/01/26 jams UIImageView animation 관련
  2. 2011/01/25 jams About Localizing
  3. 2011/01/17 jams Objects Communication in Cocoa
  4. 2011/01/15 jams Online Documents & Ebooks
  5. 2011/01/13 jams Application Preferences
  6. 2010/12/11 jams applicationWillTerminate
  7. 2010/10/28 jams [펌] 시스템 메모리 사용량에 대한 이해
  8. 2010/10/26 jams AppDelegate 얻는 방법
  9. 2010/10/15 jams Serialization and Deserialization

UIImageView animation 관련

iOS & Mac RSS Icon ATOM Icon 2011/01/26 08:29 jams
http://iphonedevelopertips.com/graphic ··· yle.html
2011/01/26 08:29 2011/01/26 08:29
받은 트랙백이 없고, 댓글이 없습니다.

댓글+트랙백 RSS :: http://jams.pe.kr/rss/response/25

댓글+트랙백 ATOM :: http://jams.pe.kr/atom/response/25

About Localizing

iOS & Mac RSS Icon ATOM Icon 2011/01/25 10:17 jams

<미국에 있을때 현재 위치 반환>

NSString *language = [[NSLocale currentLocale] objectForKey: NSLocaleLanguageCode]; // return "en"

NSString *countryCode = [[NSLocale currentLocale] objectForKey: NSLocaleCountryCode]; // return "US"


<설정된 언어 반환>

NSString *language = [[NSLocale preferredLanguages] objectAtIndex:0];



http://ykyuen.wordpress.com/2010/06/16 ··· codes%2F

2011/01/25 10:17 2011/01/25 10:17
받은 트랙백이 없고, 댓글이 없습니다.

댓글+트랙백 RSS :: http://jams.pe.kr/rss/response/23

댓글+트랙백 ATOM :: http://jams.pe.kr/atom/response/23

Mac 이나 iPhone에서 오브젝트간 메세지를 전달하는 방법은 3가지가 있다.

1. Notifications

1. 원리
object가 notification center에 message를 보내면 notification center에 등록된 selector로 해당 메세지를 보내준다.

2. 장단점
다른 object도 해당 message를 볼 수 있다. 즉, 정보를 얻을 수가 있다.
오브젝트간 1:다 관계를 형성할 수 있다.

3. 관련 클래스
NSNotificationCenter

4. 사용법
* 메세제를 받을 수 있도록 설정
[[NSNotificationCenter defaultCenter] addObserver:self selector:@(action:)];

* 센터에 메세지 보내기
[[NSNotificationCenter defaultCenter] postNotificationName:@"MessageName" object:self];


2. Delegates


1. 원리
object와 object의 1:1 관계를 정의하는 패턴이다.

2. 장단점
미리 정의할 수 있는 특정 기능을 수행해야 할 경우에 유용하다. 함수를 호출하는 방식으로 실행된다.


3. Target-Action


1. 예
버튼

2. 사용법

id target = ...; // defined elsewhere

SEL action = ...' // defined elsewhere


[target performSelector:action];

[fileDownloader downloadFile:(NSURL*)url target:(id)target didSucceed:(SEL)succeed didFail:(SEL)failed];


Ref URL
2011/01/17 21:34 2011/01/17 21:34
받은 트랙백이 없고, 댓글이 없습니다.

댓글+트랙백 RSS :: http://jams.pe.kr/rss/response/22

댓글+트랙백 ATOM :: http://jams.pe.kr/atom/response/22

Online Documents & Ebooks

iOS & Mac RSS Icon ATOM Icon 2011/01/15 17:54 jams

Objective-C 튜토리얼 번역


Tristan O'Tierney 책 Objective C Programming 번역한 곳

레퍼런스 된 곳

2011/01/15 17:54 2011/01/15 17:54
받은 트랙백이 없고, 댓글이 없습니다.

댓글+트랙백 RSS :: http://jams.pe.kr/rss/response/21

댓글+트랙백 ATOM :: http://jams.pe.kr/atom/response/21

Application Preferences

iOS & Mac RSS Icon ATOM Icon 2011/01/13 06:58 jams
Part 1 - Creating a settings bundle which will show up in settings.

Xcode에서 settings bundle 추가하는 방법 및 Specifier 정의 부분

Part 2 - Applying defaults to the settings bundle.

2011/01/13 06:58 2011/01/13 06:58
받은 트랙백이 없고, 댓글이 없습니다.

댓글+트랙백 RSS :: http://jams.pe.kr/rss/response/19

댓글+트랙백 ATOM :: http://jams.pe.kr/atom/response/19

applicationWillTerminate

iOS & Mac RSS Icon ATOM Icon 2010/12/11 05:34 jams
* 홈버튼 한번 누를때..

- os3.x : applicationWillTerminate가 호출 잘됨

- os4.x : applicationDidEnterBackground 호출됨 (cause multi tasking)


* 멀티태스킹이 지원되는 os4.x에서의 호출 순서

== 최초 실행 ==

didFinishLaunchingWithOptions

applicationDidBecomeActive

== Home button Once ==

applicationWillResignActive

applicationDidEnterBackground

== 재실행 ==

applicationWillEnterForeground

applicationDidBecomeActive

== Home button Twice ==

applicationWillResignActive


* 멀티태스킹 지원하지 않고 종료를 원할 경우

applicationDidEnterBackground에서 exit(0); 호출

2010/12/11 05:34 2010/12/11 05:34
받은 트랙백이 없고, 댓글이 없습니다.

댓글+트랙백 RSS :: http://jams.pe.kr/rss/response/18

댓글+트랙백 ATOM :: http://jams.pe.kr/atom/response/18

2010/10/28 08:12 2010/10/28 08:12
받은 트랙백이 없고, 댓글이 없습니다.

댓글+트랙백 RSS :: http://jams.pe.kr/rss/response/13

댓글+트랙백 ATOM :: http://jams.pe.kr/atom/response/13

AppDelegate 얻는 방법

iOS & Mac RSS Icon ATOM Icon 2010/10/26 11:16 jams
AppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication] delegate];


요걸 몰라서 뷰컨트롤러마다 변수로 만들었네.. -_-;;
2010/10/26 11:16 2010/10/26 11:16
받은 트랙백이 없고, 댓글이 없습니다.

댓글+트랙백 RSS :: http://jams.pe.kr/rss/response/12

댓글+트랙백 ATOM :: http://jams.pe.kr/atom/response/12

참으로 머리 아프게 했던 저장과 로딩 관련된 것들..
이제야 서서히 가닥히 잡히기 시작한다.

처음 시작할때 이름만 저장하는 간단한 DB 개념이라 plist 파일로 처리할려고 마음 먹고 예쁘게 작업을 해서 아주 멋진 NSPropertyListSerialization 함수로 NSArray도 읽고 NSDictionary도 읽고.. 나름 잘했다고 생각했다.. -_-;;


물론 NSBundle에서 파일이름으로 찾아오는 방식에서 문제가 좀 있었다.
리소스를 Project에 Add할때 Reference 타입으로 했던 것들은 inDirectory를 지정해 주지 않으면 찾을수가 없었다.


* Apple 튜토리얼 권고 코드

[[NSBundle mainBundle] pathForResource:확장자없는이름 ofType:@"plist"];


* Reference Type으로 Resource Add했을 경우

[[NSBundle mainBundle] pathForResource:확장자없는이름 ofType:@"plist" inDirectory:슬래쉬까지 포함한 경로이름];

이런것들은 사소한 거라 금방 찾을 수 있었다.

문제는 지금부터이다. -_-;;;

저렇게 했더니 "저장->저장된데이타로드"가 안되는 것이었다!!!! 왜왜왜왜왜???

구글링도 엄청했다.. 난 왤케 정보력이 없을까.. ㅠㅠ

사용자 삽입 이미지
답은 여기 있다.

MenuTest라는 App Filesystem Structure 이다.

나는 지금까지 MenuTest라는 Bundle에다가 plist파일을 넣어서 그것을 저장할려고 시도했던 것이다.

아직 확인한 바는 아니지만, Bundle 내부는 Read-Only일꺼라는 생각이 들었다.

여태껏 이것을 간과했던 것이다.

생각해보라..

저 번들 내용 Finder로 다 볼 수 있는데 수정하면 안되자너.. -_-;;

jailbreak를 하면 수정될지 건 잘 모르겠다. 일단 패스.. +_+;

정리해보면..

1. App bundle 안에는 'Read-only'만 들어간다.

2. 저장하고 싶으면 Documents에 저장해라.

(물론 iOS 4.2beta 이후 출시부터는 다른 앱과 data sharing 하지 않을려면 Library 폴더에 저장하라고 권장한다.)

3. 삽질도 이쁘게 해라. 무식하게 하는 삽질이 우대받는 세상은 이미 가고 있다!!

그럼 2번을 어떻게 하면 될까?

간단하다.

NSString *rootPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];

plistPath = [rootPath stringByAppendingPathComponent:@"test.plist"];

끝이다.

나는 정말로 무식한 삽질녀이다.

프로그래머 생활 8년 + 공부 몇년..

사람이 타고난 성향이 잘 안 바뀌는것처럼..

이 또한 잘 안 바뀐다..

참 노력많이 하는데, 왤케 똑똑하게 일을 못할까.. ㅠㅠ

"그래도 항상 이제라도 됐으니 다행이다.." 라는 긍정적인 마인드? +_+;; 가 날 포기하지 않고 이 바닥에서 밥 먹고 살게 해 주는듯 하다!!

2010/10/15 03:54 2010/10/15 03:54
받은 트랙백이 없고, 댓글이 없습니다.

댓글+트랙백 RSS :: http://jams.pe.kr/rss/response/5

댓글+트랙백 ATOM :: http://jams.pe.kr/atom/response/5