<分区>
<分区>
Possible Duplicate:
UITableViewCell with custom gradient background, with another gradient as highlight color
嘿,我想为我的 tableview 单元格添加一个轻微的渐变背景,让它们看起来更有趣。我应该只制作图像并将其放在背景上还是使用代码绘制它?如果我应该使用代码来做,你能解释一下怎么做吗?附言。我有一个自定义单元格
最佳答案
先做图片,比如gradient.jpeg。
然后在配置单元格的 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 方法中完成以下操作。
UIImage *image = [UIImage imageNamed:@"gradient.jpeg"];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
imageView.contentMode = UIViewContentModeScaleToFill;
cell.backgroundView = imageView;
[imageView 发布];
是的,通过制作图像,我的意思是在一些功能强大的图像编辑器上完成它。
关于cocoa-touch - 在 UITableViewCell 中使用渐变作为背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4184603/
相关文章:
iOS 开发 2 个不同的公司 2 个不同的开发人员许可证,1 个开发人员
c# - MonoTouch.Dialog:节标题 View 中颠倒的文本
ios - 动画时 UIViewController 的方向错误
ios - 如何使用 Core Text 获取最后一个字符的矩形
iphone - 如何获取 UITableViewCell 的总高度?
ios - 如何将 png 图像复制到剪贴板以便将其粘贴到其他应用程序中?
javascript - UI Kit - 以编程方式多次触发 Scrollspy