Get UISegmentedController value from flipside
If you just have a utility template provided by SDK with a segmented controller on the flipsideview with several segments of a decimal value, and you want to grab the current value for the mainview, what is the best way to do this? Thank you for taking the time to answer!
MainViewController.m
-(void)flipsideViewControllerDidFinish:(FlipsideViewController *)controller {
[self dismissModalViewControllerAnimated:YES];
//This does get the value, but only by going to the flipside first then back to the mainview.
SegValueLabel.text = [controller.RiseSegmentedControl titleForSegmentAtIndex:controller.RiseSegmentedControl.selectedSegmentIndex];
}
-开发者_如何学Python(IBAction)CalculateButton:(id)sender{
//Need to get the value of segmented control from FlipSideView and assign it a variable.
}
Make sure that the segmented controller is mapped to an IBOutlet property in the flipside view. If you are using the Apple utility app template, you'll see that FlipsideViewControllerDelegate is implemented by MainViewController. If you aren't using it, make a project using it as an example. Implement the flipsideViewControllerDidFinish:
method in MainView and use it to grab the property something like this:
flipsideController.segmentedControlProperty.selectedIndex;
or if you want the title:
[flipsideController.segmentedControlProperty titleForSegmentAtIndex:flipsideController.segmentedControlProperty.selectedIndex];
精彩评论