Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 将TTImageView设置为TTView上的背景_Iphone_Objective C_Ios_Coding Style_Three20 - Fatal编程技术网

Iphone 将TTImageView设置为TTView上的背景

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上设置imagebackground。 这是我在网上找到的代码,但它只显示了一个黑色方块

- (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吗?