UIToolBar在加载时瞬间变黑

时间:2015-10-26 13:19:51

标签: ios cocoa-touch

每次我加载保存下面的UIToolbar(连接到键盘)的UIView时,它会变黑一秒直到视图完全加载,然后变回标准白色。我很难过为什么会一直这样。

以下是我如何组建UIToolbar:

[self.answerField becomeFirstResponder];
UIToolbar *toolbar = [UIToolbar new];


UIBarButtonItem *sectionButton = [[UIBarButtonItem alloc] initWithTitle:@"§" style:UIBarButtonItemStylePlain target:nil
                                                                 action:@selector(addSectionSymbol:)];
UIBarButtonItem *paraButton = [[UIBarButtonItem alloc] initWithTitle:@"¶" style:UIBarButtonItemStylePlain target:nil
                                                              action:@selector(addParaSymbol:)];
UIBarButtonItem *flexSpacing = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
NSString *infoLabel = @"Select text to italicize. Always use italics.";

UIBarButtonItem *infoButton = [[UIBarButtonItem alloc] initWithTitle:infoLabel style:UIBarButtonItemStylePlain target:nil action:nil];

[infoButton setEnabled:NO];

[toolbar  setItems:[NSArray arrayWithObjects:sectionButton, paraButton, flexSpacing, infoButton, nil]];
self.answerField.inputAccessoryView = toolbar;
[toolbar sizeToFit];

有什么想法吗?

0 个答案:

没有答案