作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我无法在 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/
我无法在 TTView 上设置图像背景。这是我在网上找到的代码,但它只显示一个黑色方 block 。 - (TTView *) monthBar { if (!_monthBar) { _mo
我是一名优秀的程序员,十分优秀!