Iphone 将TTImageView设置为TTView上的背景
我很难在TTView上设置imagebackground。 这是我在网上找到的代码,但它只显示了一个黑色方块Iphone 将TTImageView设置为TTView上的背景,iphone,objective-c,ios,coding-style,three20,Iphone,Objective C,Ios,Coding Style,Three20,我很难在TTView上设置imagebackground。 这是我在网上找到的代码,但它只显示了一个黑色方块 - (TTView *) monthBar { if (!_monthBar) { _monthBar = [[[TTView alloc] init] autorelease]; _monthBar.style = TTSTYLE(calendarMonthBarStyle); _monthBar.autoresizingMask = UIViewAutores
- (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;
}
如果有人知道如何解决这个问题,请帮助我。
谢谢 通常不需要使用imageView作为_monthBar的子视图。您应该改为在样式中使用图像作为背景。您的风格似乎被称为calendarMonthBarStyle。您需要在此处添加引用picture.png的TTImageStyle。您尝试过UIImageView而不是TTImageView吗?