ios - inputaccessoryview 未显示( Storyboard)

标签 ios iphone xcode uiview xcode5

我一直在尝试在我的键盘上方合并一个 UIView/Toolbar 但没有成功。当我添加一个工具栏时,它被打乱了,因此我需要将它放入 UIViewUIView 不想出现在键盘上方。代码如下:

我的标题:

 @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 已连接:enter image description here

最佳答案

我将 textView.inputAccessoryView = AddView; 添加到 ViewDidLoad,然后从 Storyboard中删除该 View 并重新制作它。最后,我将 UIView 添加到底部黑条。

关于ios - inputaccessoryview 未显示( Storyboard),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20272907/

相关文章:

ruby-on-rails - 无法安装 autotest-fsevent 或 rs-fsevent;收到 ld 错误但已安装 xcode

swift - 将数据添加到 firebase 中的特定 UID

ios - 在 swift 中从字符串到日期的转换返回 nil

iphone - NSInternalInconsistencyException 原因 : '-[__NSCFArray replaceObjectAtIndex:withObject:]: mutating method sent to immutable object'

iphone - 如何更改Tapku日历的背景图像

ios - 当我从自定义构建配置存档时缺少文件

ios - 从 plist 刷新数据

ios - 内存保留问题

ios - 调整 PopOver View Controller 的大小

ios - WKWebView 添加为 Subview 不会在 Swift 中旋转时调整大小