我一直試圖在我的鍵盤上方加入UIView
/Toolbar
,但沒有運氣。當我添加了一個工具欄時,它被加擾,因此我需要將它放入UIView
,但UIView
不希望出現在鍵盤上方。下面的代碼:inputaccessoryview not showing(StoryBoard)
我的頭:
@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
連接:
這是什麼意思,你把視圖添加到底部的黑色欄?是否有可能在故事板中定義一個實際上未放置在擁有它的視圖控制器中的視圖?這樣的視圖在故事板中直觀地出現在哪裏,並且通過某些segue鏈接到父視圖控制器? – devios1