UIPickerView未正确对齐

时间:2014-10-31 23:35:52

标签: ios objective-c ios8 uipickerview

我在iOS8中使用UIPickerView并且遇到了一个非常奇怪的问题。这是我的一般实施:

_providerToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, self.view.bounds.size.height - 344, self.view.bounds.size.width, 44)];

UIBarButtonItem *done = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismissActionSheet:)];
_providerToolbar.items = @[[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil], done];
[self.view addSubview:_providerToolbar];

_providerPickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0, self.view.bounds.size.height - 300, 0, 0)];
_providerPickerView.showsSelectionIndicator = YES;
_providerPickerView.dataSource = self;
_providerPickerView.delegate = self;

[self.view addSubview:_providerPickerView];

这似乎在iOS7中完全正常,但在iOS8中,完成按钮似乎排列不正确。为什么在完成按钮的末尾和工具栏边框之间没有空格?

enter image description here

0 个答案:

没有答案