I've implemented ABPersonView in my application to allow a contact to be viewed. Upon choosing the email field, the email application is opened as expected except for a gray status bar which is only appearing on the iPad, on the iPhone it is not. I am not using IB and the code is very simple and standard to implement ABPersonView. If anyone needs specific code please specify which code section. I am stumped since this problem is only appearing on the iPad. How can I stop this behavior on the iPad?
Edit: I have recreated this undesired behavior with a dummy project.
#import <UIKit/UIKit.h>
#import <AddressBook/AddressBook.h>
#import <AddressBookUI/AddressBookUI.h>
@interface RootViewController: UIViewController <ABPersonViewControllerDelegate> {
}
@end
and in the .m
#import "RootViewController.h"
@implementation RootViewController
- (void)loadView {
self.view = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
self.view.backgroundColor = [UIColor whiteColor];
self.view.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
UIButton *myButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
myButton.frame = CGRectMake(21, 80, 100, 35);
[myButton setTitle:@"My Button" forState:UIControlStateNormal];
[myButton addTarget:self action:@selector(myButtonPressed) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:myButton];
}
-(void)myButtonPressed{
ABPersonViewController *personViewController = [[[ABPersonViewController alloc] init] autorelease];
personViewController.displayedPerson = [self personObject];
[self.navigationController pushViewController:personViewController animated:YES];
}
- (ABRecordRef)personObject {
ABRecordRef newRecord = ABPersonCreate();
ABRecordSetValue(newRecord, kABPersonFirstNameProperty, CFSTR("John"), nil);
ABRecordSetValue(newRecord, kABPersonLastNameProperty, CFSTR("Doe"), nil);
ABMutableMultiValueRef multiPhone = ABMultiValueCreateMutable(kABMultiStringPropertyType);
ABMultiValueAddValueAndLabel(multiPhone, @"1-222-333-4444", kABPersonPhoneMainLabel, NULL);
ABRecordSetValue(newRecord, kABPersonPhoneProperty, multiPhone, nil);
CFRelease(multiPhone);
ABMutableMultiValueRef multiEmail = ABMultiValueCreateMutable(kABMultiStringPropertyType);
ABMultiValueAddValueAndLabel(multiEmail, @"123@abc.com", kABWorkLabel, NULL);
ABRecordSetValue(newRecord, kABPersonEmailProperty, multiEmail, nil);
CFRelease(multiEmail);
ABMutableMultiValueRef address = ABMultiValueCreateMutable(kABMultiDictionaryPropertyType);
NSMutableDictionary *addressDict = [[NSMutableDictionary alloc] init];
[addressDict setObject:@"1234 AnyStreet" forKey:(NSString *)kABPersonAddressStreetKey];
[addressDict setObject:@"AnyTown" forKey:(NSString *)kABPersonAddressCityKey];
[addressDict setObject:@"AnyState" forKey:(NSString *)kABPersonAddressStateKey];
[addressDict setObject:@"55555" forKey:(NSString *)kABPersonAddressZIPKey];
ABMultiValueAddValueAndLabel(address, addressDict, kABWorkLabel, nil);
ABRecordSetValue(newRecord, kABPersonAddressProperty, address, nil);
return newRecord;
}
- (BOOL)personViewController:(ABPersonViewController *)personViewController shouldPerformDefaultActionForPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifierForValue
{
return YES;
}
@end