navigationBar = [ [UINavigationBar alloc] initWithFrame: CGRectMake(0, 0, 320, UI_NAVIGATION_BAR_HEIGHT) ]; [ navigationBar setDelegate: self]; [ navigationBar setBarStyle: 0 ]; searchField = [ [ UISearchField alloc ] initWithFrame: CGRectMake(10.0f, ([UINavigationBar defaultSize].height - [UISearchField defaultHeight]) / 2., rect.size.width - 20., [UISearchField defaultHeight]) ]; [ searchField setDisplayEnabled: YES ]; [searchField setFont: GSFontCreateWithName("Helvetica", 0, 11.0f)]; [[searchField textTraits] setReturnKeyType:6]; [[searchField textTraits] setEditingDelegate:self]; [searchField setPaddingTop:5]; [searchField setDelegate: self]; [searchField setPlaceholder:@"MxTube"]; [ navigationBar addSubview: searchField ]; [ self addSubview: navigationBar ];