Hiding a Bar button item in the view
- by devb0yax
How can you able to hide the (done) bar button item in a view?
Basically, I have a view controller added with navigation bar (in IB) then, I also added a bar button item into the nav bar.
I just want initially the (done) bar button item is hidden.. when input is in the text view the (done) button is already visible.
Any idea on this implementation on a view controller?
Here's my sample code:
@interface MyTextViewViewController : UIViewController <UITextViewDelegate>
{
UITextView *m_textView;
UIBarButtonItem *doneBarButtonItem;
}
@property(nonatomic,retain) IBOutlet UITextView *m_textView;
@property(nonatomic,retain) IBOutlet UIBarButtonItem *doneBarButtonItem;
- (IBAction)saveAction:(id)sender;
.m file:
- (void)viewDidLoad {
[super viewDidLoad];
doneBarButtonItem.hidden = YES; --> compile error!!!
}
- (void)textViewDidBeginEditing:(UITextView *)textView
{
doneBarButtonItem.hidden = NO; --> compile error!!!
}
- (IBAction)saveAction:(id)sender
{
doneBarButtonItem.hidden = YES; --> compile error!!!
...
}