2009년 1월 22일 목요일

backBarButtonItem 에 select 를 지정할 수 없다.

backBarButtonItem 의 action 을 받을 수 있을거라고 생각했는데, 불가능하다. 이유는 아래의 backBarButtonItem 에 잘 나와 있다. target, action 은 nil 로 설정되야 한다. 따라서 backButton 이 눌렸을때 특별한 처리를 할 수 없다. backBarButtonItem 을 hide 하고 leftBarButtonItem 을 customizing 해야 가능하다. 하지만! backBarButtonItem 모양의 버튼을 만들 수 없다는 단점이 있다.

Discussion
When this item is the back item of the navigation bar—when it is the next item below the top item—it may be represented as a back button on the navigation bar. Use this property to specify the back button. The target and action of the back bar button item you set should be nil. The default value is a bar button item displaying the navigation item’s title.

2008년 11월 28일 금요일

UIScrollView 를 사용하는 Contents View 에는 크기 한계가 있다.

UIScrollView 에 subView 형태로 들어가는 Contents View 에는 높이 제한이 있다.
실험결과 대략 2000px 이상 되는 높이의 subView 는 오동작을 한다. Simulator 에서는 잘 되지만, Device(iPhone, iPod touch) 에서는 화면이 깨져나온다.
이와 관련된 문서는 찾지 못했다. 누가 아는사람?

2008년 11월 25일 화요일

sendSynchronousRequest 는 Leak 을 유발한다?

NSURLConnection#sendSynchronousRequest 를 사용하면 Leak 이 발생한단다.
이런 문제를 Apple 은 왜 안고치는 걸까? App Forum 에도 비슷한 질문이 있던데, 아무런 답이 없다. --;
There is a well known leak in Apple's code for sendSynchronousRequest. Use the asynchronous methods instead. If you do a search on this forum you will find other examples of people reporting this.

Self size | Leacked Object
64 Bytes | CFRunLoopSource
64 Bytes | NSMachPort

2008년 11월 24일 월요일

NSDateFormatter 의 사용 결과

NSDateFormatter 의 각각의 옵션을 사용했을 나오는 결과

enum { // date and time format styles
NSDateFormatterNoStyle = kCFDateFormatterNoStyle,
NSDateFormatterShortStyle = kCFDateFormatterShortStyle,
NSDateFormatterMediumStyle = kCFDateFormatterMediumStyle,
NSDateFormatterLongStyle = kCFDateFormatterLongStyle,
NSDateFormatterFullStyle = kCFDateFormatterFullStyle
};

NSDate *date = [NSDate date];
dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateStyle:NSDateFormatterNoStyle];
[dateFormatter setDateStyle:NSDateFormatterShortStyle];
[dateFormatter setDateStyle:NSDateFormatterMediumStyle];
[dateFormatter setDateStyle:NSDateFormatterLongStyle];
[dateFormatter setDateStyle:NSDateFormatterFullStyle];

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

NSDateFormatterNoStyle : ()
NSDateFormatterShortStyle : 10/24/08 (M/d/yy)
NSDateFormatterMediumStyle : Oct 24, 2008 (MMM d, yyyy)
NSDateFormatterLongStyle : October 24, 2008 (MMMM d, yyyy)
NSDateFormatterFullStyle : Friday, October 24, 2008 (EEEE, MMMM d, yyyy)

Collection Class 사용시 object 의 reference count 문제

NSArray, NSDictionary 같은 Collection Class 를 사용할때 object 의 reference count 관리를 잘 해줘야 한다.
Collection Class 에 object 를 추가하는 순간 retain count 가 증가 하기 때문에 addObject 를 한 후에는 생성한 object 를 릴리즈 해 주는 것이 정신 건강에 좋다.

2008년 11월 23일 일요일

터미널에서 Objective-C (with Cocoa) 컴파일 하기



#import "Foundation/Foundation.h"

int main(int argc, const char *argv[])
{
NSLog(@"Hello World");
return 0;
}

-----------
$ gcc -o HelloWorld HelloWorld.m -framework Cocoa -framework Foundation

2008년 11월 10일 월요일

Distribution Provisioning 을 할때 주의 사항

iPhone Developer Program > Program Portal > Provisioning > Distribution 에서 Provisioning Profile 을 등록할때 Modify 를 통해서 device 를 추가하는 경우에 추가가 안되는 문제가 있다. 
다운받은 .mobileprovision 파일을 열어보면 ProvisionedDevices 라는 부분이 있는데, 이 부분에 등록한 디바이스가 추가가 되어 있는지 확인을 해봐야 한다.
Program Portal 의 버그인것 같은데, 최초에 Profile 을 등록할때 선택한 Device 만 Provisioning 이 적용되고, Modify 를 이용해서 추가로 등록한 기계는 적용이 되지 않는다.

.mobileprovision 을 다운 받아서 Device 의 ID 가 등록이 되어 있는지 꼭 확인하자!

이 문제로 참 많은 시간을 날렸는데, 애플은 이 문제에 대해서 모르는 걸까?