gpt4 book ai didi

iphone - 将 TTImageView 设置为 TTView 的背景

转载 作者:行者123 更新时间:2023-11-28 17:39:30 24 4
gpt4 key购买 nike

我无法在 TTView 上设置图像背景。这是我在网上找到的代码,但它只显示一个黑色方 block 。

- (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 的 subview 。您应该改为使用图像作为样式中的背景。您的样式似乎称为 calendarMonthBarStyle。您需要在此处添加引用“picture.png”的 TTImageStyle。

关于iphone - 将 TTImageView 设置为 TTView 的背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8717645/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com