代码:
- C/C++ code
#pragma mark -#pragma mark UITextViewDelegate- (void)doneEditting:(id)sender { [textViewContent resignFirstResponder]; self.navigationItem.rightBarButtonItem = nil;}- (void)textViewDidBeginEditing:(UITextView *)textView { self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStyleDone target:self action:@selector(doneEditting:)] autorelease];}
没有在navigation bar上面添加一个文字为Done的按钮。
怎么回事呢?
------解决方案--------------------
你好~
系统自带《Done》按钮的~
UIBarButtonItem *aItme = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(doneEditting:)];
self.navigationItem.rightBarButtonItem = aItem;
[aItem release];
希望有所帮助