Jack BeNimble
Jack BeNimble

Reputation: 36663

iOS how to present a view, then rerun calling method with input from the view

I'm working on an iOS app that uses a tab bar. An item is scanned using a barcode reader, and a callback method sets the tab bar item to the result view, then sends the request to the server. The callback from the server populates the display and the result view is shown.

However, under certain conditions which depend on the response from the server, I'd like show an alternate view which allows the user to manually enter the data, and then process the data in the same way as the callback. The manual entry display can't be shown on the tab bar.

So I create a modal view and exit the callback:

EnterTextController* enterTextController = [[EnterTextController alloc]init];
presentModalViewController:enterTextController animated:YES];
return; 

In the view, I take the input and call the same process called by the callback:

NSLog(@"Button Clicked!");
NSString *myText = myInput.text;

[self dismissViewControllerAnimated:NO completion:nil];
[self.mainViewController processMyText: myText];

The problem is the processMyText doesn't get executed. I have a breakpoint set and it never hits it.

I'm sure I'm not going about this correctly. Any suggestions would be welcome.

Upvotes: 0

Views: 36

Answers (1)

Aaron Brager
Aaron Brager

Reputation: 66242

Make sure the receiver isn't nil.

Upvotes: 1

Related Questions