1 Swift code
// // ViewController.swift // Test // // Created by 开发 on 2017/10/27. // Copyright © 2017年 com.cuanbo.beaconeu. All rights reserved. // import UIKit class ViewController: UIViewController { @IBOutlet weak var seg1: UISegmentedControl! override func viewDidLoad() { super.viewDidLoad() //dic 属性值 //UITextAttributeTextColor //UITextAttributeTextShadowColor //UITextAttributeTextShadowOffset //UITextAttributeFont //UIFontfontWithName let dic:NSDictionary = [NSForegroundColorAttributeName:UIColor.red,NSFontAttributeName:UIFont.boldSystemFont(ofSize: 25)]; seg1.setTitleTextAttributes(dic as! [AnyHashable : Any],for: UIControlState.normal); } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } }
2 效果图:
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。