ios - Add UITextField to title view of navigation item -


How do you add a text field to the title view of a navigation item and resize it properly?

This works fine if I do this with a search bar, but I do not know how to get a text field as a text field.

  myViewController .navigationItem.titleView = [UISearchBar new];  

I have suggested my comment, try the following, which I think What do you 're after.

  UITextField * textField = [[UITextField alloc] initWithFrame: CGRectMake (0, 0, self. Navigation controller. Navigationbar.fr.curv.width, 21.0)]; Self.navigationItem.titleView = textField; [Become TextField Foster Spondor];  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -