Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change the Title for a 3 segmented Control Segments, when I enter a view control?

The Segment name is Entrada. I am doing like this:

override func viewDidLoad() {
    super.viewDidLoad()

    Entrada(sender: UISegmentedControl) {
        setTitle("Action 1", forSegmentAtIndex: 0)
        setTitle("Action 2", forSegmentAtIndex: 1)
        setTitle("Action 3", forSegmentAtIndex: 2)
    }

I get errors... thow.

like image 693
fr0zt Avatar asked Dec 24 '15 15:12

fr0zt


1 Answers

Swift 3.0 use:

 @IBOutlet weak var entrada : UISegmentedControl!

  override func viewDidLoad() {
  super.viewDidLoad()

  entrada.setTitle("Action 1", forSegmentAt: 0)
  entrada.setTitle("Action 2", forSegmentAt: 1)
  entrada.setTitle("Action 3", forSegmentAt: 2) 
 } 
like image 172
Brian Avatar answered Oct 23 '22 01:10

Brian