简体   繁体   English

与此类似的自定义表格视图单元格

[英]Custom tableview cells similar to this

What is the best way to achieve this style in uitableview cells?在 uitableview 单元中实现这种风格的最佳方法是什么?

表视图

I need to know how to achieve that result.我需要知道如何达到这个结果。 I've seen tutorials but nothing similar.我看过教程,但没有类似的。 Any help would be greatly appreciated.任何帮助将不胜感激。

You can achieve this by creating a custom cell add shadows on UILabel's text and custom UISwitch.您可以通过创建自定义单元格在 UILabel 的文本和自定义 UISwitch 上添加阴影来实现此目的。 See apple's elements sample for faster performance they are using drawRect for drawing cell.查看苹果的元素示例以获得更快的性能,他们使用 drawRect 绘制单元格。 Also you will find on google about gradient cell using drawRect.您还可以在 google 上找到有关使用 drawRect 的渐变单元的信息。 That should help you to achieve the result you are looking for.这应该可以帮助您实现您正在寻找的结果。

The round up and grouping is part of the UITableView style gruped:汇总和分组是UITableView风格的一部分:

- (id)initWithFrame:myCGRect style:UITableViewStyleGrouped

The color is part of UITableViewCell background color, for the switches you would have to create those images and then add them as a subview of your UISwitch using:颜色是UITableViewCell背景颜色的一部分,对于开关,您必须创建这些图像,然后使用以下命令将它们添加为UISwitch的子视图:

//This method is inherited by UISwitch from UIView //这个方法是UISwitch从UIView继承来的

[mySwitch addSubview:yourCustomView]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM