노무현 대통령 배너

센스쟁이 프로그래머, 비트센스

비트센스's Blog is powered by Tattertools

아이폰 네비게이션바에 버튼을 넣는 방법입니다.
네비게이션바에 백그라운드 이미지를 넣은 경우에는 버튼 영역이 정상적으로 나오지 않아서 확인 중입니다. ^^;;
UIImage *image = [UIImage imageNamed:@"right.png"];

UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setBackgroundImage: [image stretchableImageWithLeftCapWidth:7.0 topCapHeight:0.0] forState:UIControlStateNormal];
[button setBackgroundImage: [[UIImage imageNamed: @"right_clicked.png"] stretchableImageWithLeftCapWidth:7.0 topCapHeight:0.0] forState:UIControlStateHighlighted];

button.frame= CGRectMake(0.0, 0.0, image.size.width, image.size.height);

[button addTarget:self action:@selector(AcceptData) forControlEvents:UIControlEventTouchUpInside];

UIView *v=[[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, image.size.width, image.size.height) ];

[v addSubview:button];

UIBarButtonItem *forward = [[UIBarButtonItem alloc] initWithCustomView:v];

self.navigationItem.rightBarButtonItem= forward;

[v release];
[image release];


1  ... 34 35 36 37 38 39 40 41 42  ... 317 

카테고리

전체 (317)
사진의 추억 (25)
진상 고객이 되자 (88)
초보 관리자 (74)
프로그램 (12)
공유의 바다 (114)

달력

«   2012/05   »
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
믹시
Daum view
BLOG main image
센스쟁이 프로그래머, 비트센스
뷰파인더로 보는 프로그래머의 세상 트위터 @picory<br> 스카이프 picory MSN drawhalf@dreamwiz.com
by 비트센스
WeMakePrice
Statistics Graph