Search code examples
iosiphonexcodeuiviewxcode5

inputaccessoryview not showing (StoryBoard)


I have been trying to incorporate a UIView/Toolbar above my keyboard but have had no luck. When I added a toolbar it was scrambled so thus I need to put it into a UIView but the UIView does not want to appear above the keyboard. Code Below:

My Header:

 @property (nonatomic, Strong) IBOutlet UITextView *textView;
 @property (nonatomic, strong) IBOutlet UIToolbar *TitleBar;
 @property (nonatomic, weak) IBOutlet UIView *AddView;

The 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.
}

The textViewDidBeginEditing:

-(void)textViewDidBeginEditing:(UITextView *)textView
{
    self.textView.inputAccessoryView = self.AddView;
}

Here is to show the UIView is connected:enter image description here


Solution

  • I added the textView.inputAccessoryView = AddView;to the ViewDidLoadthen deleted the view from my storyboard and remade it. Lastly I added the UIView to the bottom black bar.