views:

15

answers:

0

Hi, i am tryng to pass a value from a slider on the flipside view to a instance variable on the mainview that i use to create a maximum user input number. I know that most of the code works as i can send a value across by initializing maxValue with a number in the (void) viewdidload. However, when i try to initialize it as shown below it doesn;t seem to send a value. I know this as the actions on the mainviewcontroller don't work as they are supposed to. Any ideas anyone?

Flipsideviewcontroller.m

-(void) setMaxValue:(int) n
{
 maxValue = n;

}


-(IBAction) sliderChanged: (id) sender
{
 UISlider *slider = (UISlider *) sender;
 int progressAsInt = (int)(slider.value +0.5f);
 [self setMaxValue:progressAsInt]; //**************this is where it goes wrong*******
 NSString *newText = [[NSString alloc] initWithFormat:@"Max: %d", progressAsInt];
 sliderLabel.text = newText;
 [newText release];
}


Mainviewcontroller.m

- (IBAction)showInfo:(id)sender {    

 FlipsideViewController *controller = [[FlipsideViewController alloc] initWithNibName:@"FlipsideView" bundle:nil];
 controller.delegate = self;

 controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
 [self presentModalViewController:controller animated:YES];

 newEvent.maxCapacity = controller.maxValue;

 [controller release];
}