A good way to dismiss the keyboard regardless of the context is to call this method:
Code:
[self.view endEditing:YES];
I often create a quick void method in my view controllers which calls this code, and then I can easily dismiss the keyboard whenever I need to. (The "YES" being passed into the method is a boolean for whether or not the method should "force quit" whatever editing mode it tries to close if it is met with resistance.)