我需要减少两个部分之间的空间UITableView.我看了这个问题,但解决方案不允许我的自定义标题视图,因为它结合了页脚和标题的空间.
这是一张照片UITableView.黑色是UITableView背景颜色.

我正试图在我的UIViewControllers的超级视图中找到我的UILabels.这是我的代码:
func watch(startTime:String, endTime:String) {
if superview == nil {println("NightWatcher: No viewcontroller specified");return}
listSubviewsOfView(self.superview!)
}
func listSubviewsOfView(view: UIView) {
var subviews = view.subviews
if (subviews.count == 0) { return }
view.backgroundColor = UIColor.blackColor()
for subview in subviews {
if subview.isKindOfClass(UILabel) {
// do something with label..
}
self.listSubviewsOfView(subview as UIView)
}
}
Run Code Online (Sandbox Code Playgroud)
这是在Objective-C中推荐的方式,但在Swift中我除了UIViews和CALayer之外什么也得不到.我肯定在提供给这个方法的视图中有UILabel.我错过了什么?
我的UIViewController中的调用:
NightWatcher(view: self.view).watch("21:00", endTime: "08:30") // still working on
Run Code Online (Sandbox Code Playgroud)