开发者

uibutton not performing the action

开发者 https://www.devze.com 2023-03-13 17:20 出处:网络
I am developing a application in which I placed a view(view1) on a scrollView and added three vi开发者_开发技巧ews to the view1. Two of them are imageviews and the third is UIButton. I added all the t

I am developing a application in which I placed a view(view1) on a scrollView and added three vi开发者_开发技巧ews to the view1. Two of them are imageviews and the third is UIButton. I added all the three to the view1 and asked the view1 to bring the buttonView to front using bringSubViewToFront. I have written an action method for the button. For the imageView below buttonView I assigned a tap gesture recognizer and written a handler for the gesture. When I run the code and click the button the apps crashes with the an exception,

-[UIButton image]: unrecognized selector sent to instance
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIButton image]: unrecognized selector sent to instance

When I placed the debugger the debugger jumps to the gesture recognizer delegate method ;

-(BOOL)gestureRecognizerShouldBegin:(UITapGestureRecognizer *)gestureRecognizer

The code is:

-(IBAction)bookSelectedToDelete:(UIButton*)sender{
    sender.selected=YES;
    NSFileManager *fileManager=[NSFileManager defaultManager];
    NSError *error=nil;
    [fileManager removeItemAtPath:[sender.superview getPath] error:&error];
    [self loadBooks];
    NSLog(@"book deleted.......");
}
0

精彩评论

暂无评论...
验证码 换一张
取 消