开发者

how can i write an event for segment controller?

开发者 https://www.devze.com 2022-12-27 00:20 出处:网络
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.plea

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号