Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIButton Click Not working when its triggered from static library

We are trying to trigger display button from static library project using webview. while integrating static library with single view application we have got the output design. but when we tried to attempt action by clicking on Button its not working.

Below is the code,which we have used inside cocoa touch static library

UIButton *imageButton = [UIButton buttonWithType:UIButtonTypeCustom];

imageButton.frame = CGRectMake(self.view.frame.size.width-50, 10, 50, 50);

[imageButton setImage:[UIImage imageNamed:@"close.png"] forState:UIControlStateNormal];

imageButton.adjustsImageWhenHighlighted = NO;

// [imageButton addTarget:self  action:@selector(close:) forControlEvents:UIControlEventTouchUpInside];

[imageButton addTarget:self action:@selector(hideWebViewBtn:) forControlEvents:UIControlEventTouchUpInside];


-(IBAction)hideWebViewBtn:(id)sender {

      NSLog(@"Hide Button clicked");
     [self.adView removeFromSuperview];
     self.adView = nil;
     return;
 }

Below is the screenshot which displayed in single view application after integration and running. Once i click on the button its not getting clicked.

enter image description here

like image 435
sugansoft Avatar asked Oct 17 '22 09:10

sugansoft


1 Answers

try this,whether self button is triggering or not..

  [self.myButton sendActionsForControlEvents:UIControlEventTouchUpInside];

It worked for me

like image 153
Gowtham Avatar answered Oct 20 '22 22:10

Gowtham