I am creating a UIView dynamically and adding a scrollview in it. What I want is to create mutiple scrollviews and add them by using SWITCH Case.
I am passing an integer value called num on IBAction of a button on UIView. and calling the function to create a scrollview.
-(IBAction) button1pressed{
num = 1;
NSLog(@"value %d",num);
}
I have 6 IBActions like this with different values of num from 1 to 6. I want to Switch the value of num.
-(void)add_scrollview{
Switch(num) {
Case:1 {
NSLog(@"case 1 executed");
break;
}
Case:2 {
NSLog(@"case 2 executed");
break;
}
Case :3 {
NSLog(@"case 3 executed");
break;
}
default:{
break;
}
}
}
every time i click a button, it takes its respective "num" value and performs the switch. But, when i click the another button,it is not switching the value of num. It takes num's previous value.