我到处寻找谷歌对此的答案,但没有joy。我想做的是混合和匹配Teacup和ProMotion表。整张桌子很简单。只需将其添加到table_data
方法中的数据元素的哈希中即可。
stylename: :leg_cell
-而且--
Teacup::Stylesheet.new :main_screen do
style :leg_cell,
backgroundColor: UIColor.colorWithRed(238, green:238, blue:238, alpha: 1),
textColor: UIColor.greenColor
style UITableViewLabel,
textColor: UIColor.greenColor
end
用于样式表。但是..。UITableViewLabel
被忽略了,下面是:
共生体告诉我,这是一个UITableViewLabel,但我没有看到一种方式,它的风格。此外,Teacup还提供了这些整洁的:
layout do
# things here to add styled subviews
非常类似于在ProMotion中添加细化的子视图的内容。这两者是如何共存的?
有任何提示,如何使表视图标签样式为绿色?甚至可以使用TeaCup添加一些自定义的UILabels?
注意:我知道绿色很糟糕,但我使用它只是为了证明我有正确的元素样式。我会选择更有品位的东西,一旦我得到正确的造型。
谢谢!
发布于 2013-11-19 00:39:15
我建议子类PM::TableViewCell (它是UITableViewCell的一个子类),并在其中应用Teacup样式。
class MyTableViewCell < PM::TableViewCell
attr_accessor :mileage_label
stylesheet :main_screen
def layoutSubviews
layout do
# Subviews
# Apply `self.mileage_label` to your UILabel here.
end
restyle! # May be necessary?
end
end
class MyScreen < PM::TableScreen
def table_data
[{
cells: [{
cell_class: MyTableViewCell,
title: "whatever",
properties: {
mileage_label: "My mileage label",
}
}]
}]
end
end
https://stackoverflow.com/questions/20055842
复制相似问题