i want to write an event for the segment controller.By clicking First Tab i want to perform some calcul开发者_如何学编程ation and by clicking Second Tab i want to perform some different operation.please help me.
Create an IBAction
-(IBAction)segCtrlValueChanged:(UISegmentControl*)segCtrl;
and then link the "Value Changed" event to this action in Interface Builder, or programmatically, call
[segmentationControl addTarget:foo action:@selector(segCtrlValueChanged:)
forControlEvents:UIControlEventValueChanged];
If the IBAction, check segCtrl.selectedSegmentIndex
to see which item is active.
精彩评论