我已将UIToolBar
与UIBarButtonItem
作为inputAccessoryView添加为UITextView
。它工作正常,但UIBarButtonItem可以在它的框架之外触摸,也许在右边外面有50个像素。这没什么大不了的,但它让我很烦恼。有人知道为什么iOS - UIToolBar作为UITextView的inputAccessoryView
这是我的代码(ARC):
UIToolbar *toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, self.view.bounds.size.height, 320, 44)];
toolBar.barStyle = UIBarStyleBlack;
toolBar.translucent = YES;
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(doneWriting:)];
[toolBar setItems:[NSArray arrayWithObjects:doneButton, nil]];
self.messageTextView.inputAccessoryView = toolBar;
如果是这样的话,对我来说,感觉更像是“马虎”的编程,让按钮在其界限之外作出反应,哦。 – 2012-02-24 13:24:35