2012-01-03 1 views
1

TTView에서 이미지 배경을 설정하는 데 문제가 있습니다. 여기에 인터넷에서 발견 된 코드가 있지만 검은 색 사각형 만 보여줍니다.TTview에서 배경으로 TTImageView 설정

- (TTView *) monthBar { 
if (!_monthBar) { 
    _monthBar = [[[TTView alloc] init] autorelease]; 
    _monthBar.style = TTSTYLE(calendarMonthBarStyle); 
    _monthBar.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin; 
    TTImageView *imageView = [[TTImageView alloc]initWithFrame:CGRectMake(0, 0, 480, 20)]; 
    [imageView setDefaultImage:[UIImage imageNamed:@"picture.png"]]; 
    [self.monthBar addSubview:imageView]; 
    [imageView release]; 
    [self addSubview: _monthBar]; 
} 
return _monthBar; 
} 

누군가가 문제를 해결하는 방법을 알고 있다면 도와주세요. 감사합니다.

+0

TTImageView 대신 UIImageView를 사용해 보셨습니까? –

답변

0

_monthBar의 하위보기로 imageView를 사용하는 것이 일반적으로 필요하지 않습니다. 대신 이미지를 스타일의 배경으로 사용해야합니다. 귀하의 스타일은 calendarMonthBarStyle 인 것으로 보입니다. 거기에 "picture.png"를 참조하는 TTImageStyle을 추가해야합니다.