-
Notifications
You must be signed in to change notification settings - Fork 0
SegmentedControl
Mohammad Azmal Hossain edited this page Mar 6, 2017
·
1 revision
let customSegmentedControl = UISegmentedControl (items: ["one","two","three"]) customSegmentedControl.frame = CGRect(x: 60, y: 250, width: 200, height: 30) customSegmentedControl.selectedSegmentIndex = 1 customSegmentedControl.tintColor = UIColor.red customSegmentedControl.addTarget(self, action: #selector(segmentedValueChanged), for: .valueChanged) self.view.addSubview(customSegmentedControl)
// this func put outside of segmented scope
func segmentedValueChanged(sender:UISegmentedControl!)
{
print("It Works, Value is \(sender.selectedSegmentIndex)")
}