Swift中的外观代理(iOS)

DBo*_*yer 5 ios swift ios8

有人试过在swift中使用外观代理吗?

这个语法不起作用,有没有人想出如何在segmentedControl或UITabBar等控件上设置标题文本属性?我想我很亲密

segmentedControl.titleTextAttributesForState(UIControlState.Normal) = 
NSDictionary(objects: [UIFont(name: fontFamilyRegular, size: 16.0)], 
forKeys: [NSFontAttributeName])
Run Code Online (Sandbox Code Playgroud)

Cez*_*zar 10

这应该这样做:

segmentedControl.setTitleTextAttributes([
    NSFontAttributeName: UIFont(name: "Helvetica", size: 16.0)!,
    NSForegroundColorAttributeName: UIColor.blueColor()
    ], forState: UIControlState.Normal)
Run Code Online (Sandbox Code Playgroud)