navigationItem中加入UISegmentedControl

模拟器上显示会飘移,感觉是navigationItem的初始化没完成,segmented就开始加载了,修改了一下初始值

var seg = UISegmentedControl(frame: CGRectMake(160, 120, 8, 30))
seg.insertSegmentWithTitle(Strings.CleanTable, atIndex: 0, animated: true)
self.navigationItem.titleView = seg
seg.insertSegmentWithTitle(Strings.CheckTable, atIndex: 1, animated: true)
seg.selectedSegmentIndex = 0

你可能感兴趣的:(navigationItem中加入UISegmentedControl)