0

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
Jesse
  • 13
  • 4

1 Answers1

0

What exactly is your desired behaviour?

If you wish to remove the status bar entirely, you could hide it by using:

[[UIApplication sharedApplication] setStatusBarHidden:YES];

You're also able to set its style and frame. All of this is here in the Apple Developer documentation. See Controlling App Appearance.

SpacePyro
  • 3,121
  • 4
  • 25
  • 30
joels
  • 1,292
  • 15
  • 21
  • The problem is the gray status bar is only appearing when the email field is tapped, only on the iPad. Any other fields do not produce the gray status bar and again it's only happening on the iPad. iMessage, call, share contact, directions, and etc do not produce this at all, none of them produce it on the iPhone. If it was a `setStatusBarHidden` problem it would happen on all fields for both devices – Jesse Apr 09 '14 at 00:19