My requirment is to if i click on button1 corresponding images has to come in next view by swipe gestures,so for that i am sending sender value to the child view controller
viewcontroller.m
-(IBAction)cricket:(id)sender
{
//cricket is a button
NSString *str=[cricket currentTitle];
ChildViewController *child=[[ChildViewController alloc]init];
[child handleSwipe:str];
}
and here is
childviewcontroller.m
int imageIndex=4;
- (IBAction)handleSwipe:(UISwipeGestureRecognizer *)sender
{
if([sender isEqual:@"cricket"]))
{
NSArray *images=[[NSArray alloc]initWithObjects:[UIImage imageNamed:@"exterior1.png"], [UIImage imageNamed:@"cricket.png"],[UIImage imageNamed:@"floor_plan1.png"],Nil];
UISwipeGestureRecognizerDirection direction=[(UISwipeGestureRecognizer *)sender direction];
switch (direction) {
case UISwipeGestureRecognizerDirectionLeft:
imageIndex++;
break;
case UISwipeGestureRecognizerDirectionRight:
imageIndex--;
default:
break;
}
imageIndex=(imageIndex<0) ? ([images count]-1):
imageIndex % [images count];
[images objectAtIndex:imageIndex];
}
i was badly strucked up with this thing ,please help me