我了解AccessoryViews和测试苹果的例子:KeyBoardAccessory没有键盘的TextView上的AccessoryView?
我试图显示附属视图避免了键盘显示的,但我不能这样做:-(
我米textViewShouldBeginEditing不会回来,避免键盘和返回之前动画TextView的的大小调整,但没有任何反应。
我做错了什么?
- (void)viewWillAppear:(BOOL)animated {
// Make the keyboard appear when the application launches.
[super viewWillAppear:animated];
[textView becomeFirstResponder];
}
- (BOOL)textViewShouldBeginEditing:(UITextView *)aTextView {
NSLog(@"textViewShouldBeginEditing");
/*
You can create the accessory view programmatically (in code), in the same nib file as the view controller's main view, or from a separate nib file. This example illustrates the latter; it means the accessory view is loaded lazily -- only if it is required.
*/
if (textView.inputAccessoryView == nil) {
[[NSBundle mainBundle] loadNibNamed:@"AccessoryView" owner:self options:nil];
// Loading the AccessoryView nib file sets the accessoryView outlet.
textView.inputAccessoryView = accessoryView;
// After setting the accessory view for the text view, we no longer need a reference to the accessory view.
self.accessoryView = nil;
}
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1];
textView.frame = CGRectMake(textView.frame.origin.x, textView.frame.origin.y, textView.frame.size.width, textView.frame.size.height - 100);
[UIView commitAnimations];
return NO;
}
你能解释一下你试图深入的结果吗?当您单击文本视图而不是键盘和附件视图时,只需要与键盘相关的配件视图出现? – 2010-08-05 18:37:20
是的,我想只显示配件,但我错了关于要使用的属性,我需要一个inputView – rubdottocom 2010-08-06 10:21:16