首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >UITableView.appearance().separatorStyle不工作

UITableView.appearance().separatorStyle不工作
EN

Stack Overflow用户
提问于 2015-04-23 18:59:46
回答 1查看 2K关注 0票数 3

在我的AppDelegate中,我设置了UITableView的外观,比如背景和rowHeight等等,但不知怎么的,它并不适用于separatorStyle。它不起作用有什么原因吗?还是这是个bug?我在ViewController中设置tableView.separatorStyle = .None本身没有问题。

我的AppDelegate中的代码:

代码语言:javascript
复制
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    application.statusBarHidden = true

    UIToolbar.appearance().barTintColor = UIColor.grayColor()

    UITableView.appearance().backgroundColor = UIColor.blackColor()
    UITableView.appearance().rowHeight = 40
    UITableView.appearance().separatorStyle = .None

    UITableViewCell.appearance().backgroundColor = UIColor.clearColor()

    return true
}

奇怪的是,separatorColor确实起作用。

编辑:

当我检查UITableView时,会发现:

代码语言:javascript
复制
// Appearance

var sectionIndexMinimumDisplayRowCount: Int // show special section index list on right when row count reaches this value. default is 0
@availability(iOS, introduced=6.0)
var sectionIndexColor: UIColor? // color used for text of the section index
@availability(iOS, introduced=7.0)
var sectionIndexBackgroundColor: UIColor? // the background color of the section index while not being touched
@availability(iOS, introduced=6.0)
var sectionIndexTrackingBackgroundColor: UIColor? // the background color of the section index while it is being touched

var separatorStyle: UITableViewCellSeparatorStyle // default is UITableViewCellSeparatorStyleSingleLine
var separatorColor: UIColor! // default is the standard separator gray
@availability(iOS, introduced=8.0)
@NSCopying var separatorEffect: UIVisualEffect? // effect to apply to table separators

有点奇怪,因为它在评论Appearance下面。与separatorColor相比,头也没有任何不同。

EN

回答 1

Stack Overflow用户

发布于 2015-04-23 19:14:59

这没有什么“奇怪”、“不工作”或“小马车”。并不是所有的东西都是外观与代理兼容的。查看标题:

代码语言:javascript
复制
@property (nonatomic) UITableViewCellSeparatorStyle separatorStyle; // default is UITableViewCellSeparatorStyleSingleLine
@property (nonatomic, retain) UIColor *separatorColor UI_APPEARANCE_SELECTOR; // default is the standard separator gray

注意到什么了吗?separatorColor标记为UI_APPEARANCE_SELECTORseparatorStyle不是。这意味着您可以在外观代理中使用separatorColor,而不能在外观代理中使用separatorStyle

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29832119

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档