Tag: inputaccessoryview

Swift:inputAccessoryViewbutton不显示

以下是我的代码添加一个inputAccessoryView(与一个完成button就可以了)到我的textView: let keyboardButtonView = UIToolbar() keyboardButtonView.sizeToFit() let doneButton = UIBarButtonItem(image: nil, style: .Done, target: self, action: "closeMessageViewKeyboard") doneButton.possibleTitles = ["Done"] var toolbarButtons = NSMutableArray() toolbarButtons.addObject(doneButton) keyboardButtonView.items = toolbarButtons as [AnyObject] messageView.inputAccessoryView = keyboardButtonView 完成button从不出现。 我得到的只是一个白色的配件吧。 我在这里错过了什么?

UISplitViewController仅用于详细说明inputAccessoryView

我试图根据消息input工具栏模仿苹果的iMessage应用程序。 苹果有一个UIToolbar ,它是它包含的UITextView的input附件视图,也是实际视图的inputAccessoryView 。 这样,工具栏总是存在,当键盘出现时,它随着键盘滑动。 在iPad上,他们似乎有一个UISplitViewController ,工具栏是详细视图控制器的一部分。 现在,当我有相同的设置,我的细节视图的input附件工具栏延伸到整个宽度,所以就像键盘,它也重叠主视图控制器。 另一方面,苹果以某种方式设法将input配件限制在细节视图的约束范围内。 我怎样才能做到这一点?

调整inputAccessoryView中的文本字段的大小

我一直在试图让UITextView整个星期resize。 我不明白应该怎么做,所以我决定把所有相关的代码都包括在内。 我有这个对话视图: 这个conversationview是一个带UITableView的UIViewController (使用约束)。 我有一个自定义的UIView子类ConversationToolbar设置为inputAccessoryView (包含它的UIViewController可以成为第一响应者,所以视图始终可见),包含2个子视图。 一个用于UITextView和左右button,另一个用于表情符号。 表情符号仅在点击左键时显示: 当select一个时,它显示在一个浮动标签上: 当使用多行时,我现在无法调整这个UITextView大小。 我试图自己计算所有的框架,但那似乎与我的约束以某种奇怪的方式相冲突。 几乎总是UITextView太小,或者只有当我按下另一个键来更新视图时才resize。 或者UITextView在键盘上变得更大,或者当键盘被解散时它滑出视图。 我已经从我的代码中删除了所有resize的function,我想知道我需要做什么来resize。 在我的ConversationViewController : var toolbar: ConversationToolbar! override var inputAccessoryView: UIView! { get { if toolbar == nil { toolbar = NSBundle.mainBundle().loadNibNamed("ConversationToolbar", owner: nil, options: nil).last! as ConversationToolbar toolbar.frame.size = CGSize(width: UIScreen.mainScreen().bounds.size.width, height: 80) toolbar.delegate = self toolbar.setDraft(conversation.draft) } return toolbar } […]

改变inputAccessoryView问题的高度

当我在iOS 8中更改inputAccessoryView的高度时,inputAccessoryView不会转到正确的原点,而是覆盖键盘。 以下是一些代码片段: 在表视图控制器 – (UIView *)inputAccessoryView { if (!_commentInputView) { _commentInputView = [[CommentInputView alloc] initWithFrame:CGRectMake(0, 0, [self width], 41)]; [_commentInputView setPlaceholder:NSLocalizedString(@"Comment", nil) andButtonTitle:NSLocalizedString(@"Send", nil)]; [_commentInputView setBackgroundColor:[UIColor whiteColor]]; _commentInputView.hidden = YES; _commentInputView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleBottomMargin; } return _commentInputView; } 在CommentInputView中 #when the textview change height – (void)growingTextView:(HPGrowingTextView *)growingTextView willChangeHeight:(float)height { if (height > _textView_height) […]

在iOS 8中更改inputAccessoryView的框架

很久以前的潜伏者 – 第一次海报! 我有一个问题,而像WhatsApp那样用UITextView重新创build一个栏。 我正在使用一个自定义的UIView子类,并懒洋洋地实例化它: – (UIView *)inputAccessoryView 并返回YES: – (BOOL)canBecomeFirstResponder 现在,我想在UITextView的大小增长时更改inputAccessoryView的大小。 在iOS 7上,我只是简单地改变视图框架的大小,而不是原始视图的大小,然后调用reloadInputViews ,它将工作:视图将向上移动,以便在键盘上完全可见。 但是在iOS 8上,这不起作用。 使其工作的唯一方法是也将框架的起源改为负值。 这样会很好,除了它会产生一些奇怪的错误:例如, UIView在input任何文本时会返回到“原始”框架。 有什么我失踪? 我很确定WhatsApp使用inputAccessoryView因为他们closures拖动键盘的方式 – 只在最新版本的应用程序。 请让我知道,如果你能帮助我! 或者如果有任何testing,你想让我跑步! 谢谢! 🙂 顺便说一句,这里是我用来更新自定义UIView称为composeBar的高度的composeBar : // ComposeBar frame size CGRect frame = self.composeBar.frame; frame.size.height += heightDifference; frame.origin.y -= heightDifference; self.composeBar.frame = frame; [self.composeBar.textView reloadInputViews]; // Tried with this [self reloadInputViews]; […]

由于未捕获exception“UIViewControllerHierarchyInconsistency”而终止应用程序,

我在两个button的select器上方创build了一个工具栏,并在ios7上运行,当我在ios8崩溃中运行时: 终止应用程序二未捕获的exception“UIViewControllerHierarchyInconsistency”,原因:“子视图控制器:应该有父视图控制器:但要求的父母是:” 这是在ios7中安静地工作的一段代码: expiredPromoTextField.inputView = DatePicker; expiredPromoTextField.delegate = self; quantityPromoTextField.inputView = quantityPicker; quantityPromoTextField.delegate = self; // Create button to close the UIPickerView UIToolbar * mypickerToolbar = [[UIToolbar alloc] initWithFrame: CGRectMake (0, 0, 320, 56)]; mypickerToolbar.barStyle = UIBarStyleBlackTranslucent; [mypickerToolbar sizeToFit]; NSMutableArray * barItems = [[NSMutableArray alloc] init]; UIBarButtonItem * CancelBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem: UIBarButtonSystemItemCancel target: […]