Dailycode.info

Short solution for short problems

iOS: Hide keyboard on edit begin before picker view

I wanted to show a picker view in a popup when I click in a text field. But I do not want to show the keyboard. Now this was not a problem when you click directly in the textfield. But when coming from another textfield with the keyboard enabled, the keyboard stayed visible. 

I solved it with a simple call before I show the picker view:

- (IBAction)LocationDidBegin:(id)sender

{

    [self.txtLocation performSelector:@selector(resignFirstResponder) withObject:nil afterDelay:0.2];

    [selfShowLocationPicker];

}

So that did the trick.


iOS: cannot find manuel segue

I had an application with a dashboard with dynamic number of button. Based on the button description, a segue would be triggered. This works fine. But at a moment, a certain push segue was not found. So I triple checked the name, debugged and debugged, but could not find the problem. Also the application did no respond to other segues anymore. 

The problem was that I copy a view controller on the story board, then changed it and created a new manuel segue to it. Were the view controller of which I copied the new VC from was also referring. This was causing the problem. I guess there is somewhere still a reference because it was a copy. 

Now I solved it by simply adding a new view controller to the story board, then copy paste all controls to this and changed the view controller class. Deleted the first copy, then set the manual segue to the new view controller and everything worked. I had to hook up all the outlets and events off course.