-[UIImage direction]: unrecognized selector sent to instance
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
{
arr=[[NSArray alloc]initWithObjects:[UIImage
imageNamed:@"exterior1.png"], nil];
NSString *str= [arr objectAtIndex:0];
ChildViewController *child=[[ChildViewController alloc]init];
[child handleSwipe:str];
}
and here is
childviewcontroller.m
if([sender isEqual:[UIImage imageNamed:@"exterior1.png"]])
{
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];
img.image=[UIImage imageNamed:[images objectAtIndex:imageIndex]];
}
i was badly strucked up with this thing ,please help me
No comments:
Post a Comment