Vikas Singh
Vikas Singh

Reputation: 1791

UIButton's click(IBAction) not getting triggered programatically

I have a simple UIButton in a viewController.

- (IBAction)btnEnter:(id)sender {
   ..
   ..
}

Now I want to trigger the button press action programatically one of library functions (didFinishPickingmediaWithInfo) gets executed

- (void) imagePickerController: (UIImagePickerController*) reader didFinishPickingMediaWithInfo: (NSDictionary*) info
{

// Do Something

txtBoxAboveEnterButton = @"Data populated successfully";

[self btnEnter:nil];

[reader dismissModalViewControllerAnimated: YES];
}

The function is getting called and the text box above Enter button is getting populated with the dummy text but click is not getting triggered. Please help me out!

Upvotes: 0

Views: 717

Answers (1)

Stefan H
Stefan H

Reputation: 6683

The method you are calling is btnEnter with no parameter. It doesn't look like you have that defined. Try passing a paramter like nil or self to it:

[self btnEnter:nil]; 

Upvotes: 1

Related Questions