iphone - Objective C how to add textfield into navigation bar -


I'm trying to add a text file to a navigation bar, but it does not appear in the simulator. Inside as:

  UITextView * textField = [[UITextView alloc] initWithFrame: CGRectMake (0, 0, 170, 44)]; Self.navigationItem.titleView = textField;  

Any ideas?

Thank you!

I did it like this, I know that you have received the answer yet, but still This will be useful to anyone so that it can be done in this way

  - (zero) visibleVIPE: Animated {BOOL} {imgVw = [[UIImageView alloc] initWithFrame: CGRectMake (68, 7 , 180, 28)]; [IMGVV set image: [UIImage imageNamed: @ "textfieldBackground.png"]]; [Self. Navigation Controller Add navigationbarviewviewview: imgVw]; TextfieldTxt = [[UITextField alloc] initWithFrame: CGRectMake (78, 11, 170, 25)]; TextfieldTxt.backgroundColor = [UIColor clear collar]; [Text field text setoutCorking type: UITextAutocorrectionTypeNo]; TextfieldTxt.delegate = self; [Self. Navigation Controller Add navigationbarviewviewview: textfieldtext]; }  

Please do not forget to remove from supervision, when viewdidunload

  - (zero) view viewDidUnload {[super viewDidUnload]; [Remove TextfieldTexProSuView]; [IMGVView removedFrosporview]; }  

thanks


Comments