Quantcast
Channel: User Burhanuddin Sunelwala - Stack Overflow
Viewing all articles
Browse latest Browse all 36

iOS 10.3 UISegmentedControl setTitleTextAttributes Crash

$
0
0

iOS 10.3 crashes on UISegmentedControl's setTitleTextAttributes method.

Question:

  1. What is the reason for the crash?
  2. What is the solution?

Note: Have already reported this issue to apple, but haven't yet heard from them.https://openradar.appspot.com/31448227

Sample Code:

class ViewController: UIViewController {    @IBOutlet private weak var segmentedControl: UISegmentedControl!    override func viewDidLoad() {        super.viewDidLoad()                 //Crash!                segmentedControl.setTitleTextAttributes([UIFont.systemFont(ofSize: 14.0) : NSFontAttributeName], for: .normal)    }}

EDIT

As @vedian pointed out, it should be [key : value] and not the other way around, but the above code doesn't crash on iOS versions below 10.3.


Viewing all articles
Browse latest Browse all 36

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>