2011-03-09 3 views
1

내 RootView에 테이블 위의 UIImage를 기쁘게 표시하고 싶습니다. 내가 어떻게 할 수 있니?UIImageView in RootView

+0

는 "위의"무엇을 의미합니까? 이미지를 테이블보기의 시작 부분에 배치하거나 직접 배치할까요? – hennes

답변

0

setBackgroundView 메소드를 사용해야합니다.

약간의 예 :

// my image 
UIImage *image = [[[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"my_image" ofType:@"png"]] autorelease]; 

// an imageView to put the imagen on 
UIImageView *imageView = [[[UIImageView alloc] initWithImage:image] autorelease]; 

// we set the background of the table with the imageView  
[myTable setBackgroundView:imageView]; 
+0

자동 출시가 필요하지 않습니까? backgroundView 속성은 retain 키워드로 정의되므로 setBackgroundView를 호출 한 후 이미지와 이미지보기를 안전하게 해제 할 수 있습니다. – hennes

+0

정확히, 자동 해제가 필요하지 않습니다. 그것은 단지 하나의 (내 많은) 습관입니다. 죄송합니다 코드의 주요 목적에서 당신을 혼란스럽게하는 경우. –