2010-04-17 29 views

回答

1

創建一個IBAction爲

-(IBAction)segCtrlValueChanged:(UISegmentControl*)segCtrl; 

,然後在 「值改變」 事件鏈接到在Interface Builder,編程這一行動,呼籲

[segmentationControl addTarget:foo action:@selector(segCtrlValueChanged:) 
       forControlEvents:UIControlEventValueChanged]; 

如果IBAction爲,檢查segCtrl.selectedSegmentIndex到看哪個項目是活動的。