我一直在尝试在我的键盘上方合并一个 UIView
/Toolbar
但没有成功。当我添加一个工具栏时,它被打乱了,因此我需要将它放入 UIView
但 UIView
不想出现在键盘上方。代码如下:
我的标题:
@property (nonatomic, Strong) IBOutlet UITextView *textView;
@property (nonatomic, strong) IBOutlet UIToolbar *TitleBar;
@property (nonatomic, weak) IBOutlet UIView *AddView;
ViewDidLoad
:
- (void)viewDidLoad
{
// observe keyboard hide and show notifications to resize the text view appropriately
/*[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
object:nil];
*/
if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
// iOS 7
[self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
} else {
// iOS 6
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
}
self.attributionTitle.delegate = self;
self.attribution.delegate = self;
textView.scrollEnabled = YES;
// quoteText.layer.borderColor = [UIColor blackColor].CGColor;
// quoteText.layer.borderWidth = 1.0f;
// textView.delegate = self; // code or in IB
[textView becomeFirstResponder];
[super viewDidLoad];
// Do any additional setup after loading the view.
}
textViewDidBeginEditing
:
-(void)textViewDidBeginEditing:(UITextView *)textView
{
self.textView.inputAccessoryView = self.AddView;
}
此处显示 UIView
已连接:
最佳答案
我将 textView.inputAccessoryView = AddView;
添加到 ViewDidLoad
,然后从 Storyboard中删除该 View 并重新制作它。最后,我将 UIView
添加到底部黑条。
关于ios - inputaccessoryview 未显示( Storyboard),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20272907/