UIDatePickerViewController is in Use

April 26, 2010
Cocoa Touch iPad Numerology

Today I was working on Numerology for the iPad and I was trying to implement a date picker inside a popover. You can’t just put a UIDatePicker in the popover because you need a view controller. So I created a view controller and called it UIDatePickerViewController. It simply would not work. All I would get is a popover with a black area. I couldn’t figure out what was going on. Then I decided to just use the UIViewController class but load in the nib I created for my view controller. Viola it started to work. Then I realized my class name was the problem. I renamed the class DatePickerViewController and it worked as well. Somewhere Apple must have a private class called UIDatePickerViewController. Bottom line: Don’t use class names similar to Apple’s class names. It will bite you sooner or later.