【问题标题】:ABPeoplePickerNavigationController navigation barStyle BlackTranslucent dislocates layoutABPeoplePickerNavigationController 导航栏Style BlackTranslucent 布局错位
【发布时间】:2013-02-28 10:23:16
【问题描述】:

条形样式为BlackOpaque 我的人员选择器看起来像:

但是当我希望 barStyle 为 BlackTranslucent 时,它看起来像这样:

我已经尝试过here的解决方案

代码:

- (void)showPeoplePickerController
{
    ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
picker.peoplePickerDelegate = self;

NSArray *displayedItems = [NSArray arrayWithObjects:[NSNumber numberWithInt:kABPersonPhoneProperty],
                           [NSNumber numberWithInt:kABPersonEmailProperty],
                           [NSNumber numberWithInt:kABPersonBirthdayProperty],[NSNumber numberWithInt:kABPersonAddressProperty],nil];

picker.displayedProperties = displayedItems;
picker.navigationBar.barStyle = UIBarStyleBlack;

//  picker.navigationBar.translucent = YES; //uncommented for translucent bar


[self.navigationController presentModalViewController:picker animated:YES];

}

但是我该如何从 PeoplePicker 下移呢?

【问题讨论】:

  • 分享一些代码...如何添加 ABPeoplePickerNavigationController 导航栏样式...
  • @Vishal:请看我的编辑

标签: iphone ios abpeoplepickerview peoplepicker


【解决方案1】:

OK 代替这个:

[self.navigationController presentModalViewController:picker animated:YES];

如下所示显示您的 ABPeoplePickerNavigationController:

[self.navigationController presentViewController:picker animated:YES completion:nil];

对于条形颜色检查这一行:picker.navigationBar.tintColor=[UIColor blackColor];

【讨论】:

  • 我不认为这是解决我面临的问题的方法。 iOS4.2上tintcolor不行,而presentviewcontroller在iOS6上可以,但是怎么解决半透明bar上tableview上浮的问题?
【解决方案2】:

您为什么首先使用半透明导航栏?人物选择器视图控制器不适合与半透明导航栏一起使用。

如果您有充分的理由这样做,则需要进行一些修改以使内容正确显示:
您必须修改显示的表格视图的contentInset 属性,以便内容从导航栏下方开始。

但是:无法访问显示的表格视图,抱歉。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-01-13
    • 2011-06-24
    • 2018-01-10
    • 2018-07-02
    • 1970-01-01
    • 1970-01-01
    • 2021-11-13
    相关资源
    最近更新 更多