Jean-Luc Godard
Jean-Luc Godard

Reputation: 1883

SegmentControllerer First segment should always been selected when i start the application in iphone

I am using a segment control.

in that there are three segments..segment 1,segment 2,segment 3..

My problem..

when I start the application..

I want that the first segment should always selected..

Suggestion please...

Upvotes: 0

Views: 1053

Answers (2)

Jean-Luc Godard
Jean-Luc Godard

Reputation: 1883

Did it...!!!

In viewWillAppear i put the below code...

switch (selectedTag){

    case 0:
        segmentControl.selectedSegmentIndex = 0;
        break;
    case 1:
        segmentControl.selectedSegmentIndex = 1;
        break;
    case 2: 
        segmentControl.selectedSegmentIndex = 2;
        break;
    default:    
        segmentControl.selectedSegmentIndex = 0;
}
[super viewWillAppear:animated];  
[self.myTableVies reloadData];

Upvotes: 0

user23743
user23743

Reputation:

segmentedControl.selectedSegmentIndex = 0; somewhere in your startup code.

Upvotes: 1

Related Questions