I have a subclass of ABNewPersonViewController
defined in storyboard, and embedded there in a navigation controller, as required by the docs. The navigation controller is itself controlled by a tab bar controller. In the identity inspector, the class has been set to the subclass.
In the subclassed ABNewPersonViewController
I do the test initialization in viewDidLoad
:
- (void)viewDidLoad
{
[super viewDidLoad];
self.newPersonViewDelegate = self;
ABRecordRef newPerson= ABPersonCreate();
CFErrorRef error = NULL;
ABRecordSetValue(newPerson, kABPersonFirstNameProperty, CFSTR("First"), &error);
ABRecordSetValue(newPerson, kABPersonLastNameProperty, CFSTR("Last"), &error);
assert(!error);
[self setDisplayedPerson:newPerson];
}
In my subclass I have also implemented the delegate method newPersonViewController:didCompleteWithNewPerson:
, but this does not matter.
When I select the tab in the tab bar controller, a black screen is displayed.
Any idea what I am doing wrong?
PS: I know how to set it up programmatically, but I would like to do it in storyboard.
EDIT
When I do it programmatically, the subclass is initialized by alloc
& init
. This works correctly. When the subclass is instantiated from storyboard, it receives initWithCoder:
. To test it, I implemented initWithCoder:
in the following way:
- (id)initWithCoder:(NSCoder*)coder{
self = [super init];
return self;
}
In this case, the entry mask of ABNewPersonViewController
is indeed displayed, but the navigation bar is not shown empty. I know this initialization hack is wrong, but does anybody know how to do it right?
EDIT
The navigation bar was not shown, because I set it to hidden. Normally, it is shown, but the buttons "done" and "cancel" are missing. This is of course no surprise, because the superclass is not initialized by initWithCoder:
but by init
.
Still the question is why the entry mask is not shown, but a black screen only.