带有UIToolBar问题的UIPickerView

时间:2014-07-08 14:32:01

标签: ios xcode uipickerview uitoolbar

我遇到UIPickerView的问题,UIToolBar有一个完成按钮。问题是按钮完成有时会显示为蓝色(正常行为),有时按钮会以难看的灰色显示(参见附图)。

Issue with the UIPickerView toolbar button

选择器视图和工具栏以这种方式生成:

mypickerToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 56)];
mypickerToolbar.barStyle = UIBarStyleBlackOpaque;
[mypickerToolbar sizeToFit];

NSMutableArray *barItems = [[NSMutableArray alloc] init];
UIBarButtonItem *flexSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
[barItems addObject:flexSpace];

UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStyleDone target:self action:@selector(pickerDoneClicked:)];
[barItems addObject:doneBtn];

[mypickerToolbar setItems:barItems animated:YES];
statusTextField.inputAccessoryView = mypickerToolbar;

我没有运气地搜索过它。

0 个答案:

没有答案