tags:

views:

27

answers:

1

i have leftnavbutton and rightnav button now how to add search bar in between them

right now i am using this self.tableView.tableHeaderView = searchBar;

but this bar goes up when you serach item downside so i want to make it at top always visible;

A: 

You can also do it by add searchbar below the navigationbar and below that add tableview, so when you scroll the table searchbar will not move.

You can also add searchbar in navigationvar using the following code

self.navigationItem.titleView = searchbar;
Reena
Hi reena if i do that self.navigationItem.titleView = searchBar;then my searchbar is shrinking on toplets say is it possible to keep my serach bar below nav bar but fixed should not move when i go down the table
ram
first you just put searchbar in your view and below that put uitableview then it will nor move when you go down to the table
Reena
i did exactly what you said but of no useself.tableView.tableHeaderView = searchBar; wil always push serach bar on top of table view
ram
ya now need for tableHederview.
Reena
then what should i do???
ram
if i reove that then only table view is showing not search bar
ram
as i have told you previously "first put searchbar in your view and below that put uitableview then it will not move when you go down to the table " searchbar and tableview will be the separate control Remove searchbar from tableHeaderview
Reena
put searchbar at the top (x = 0, y = 0)and for tableview (x = 0,y = 45)
Reena
NO NO NO NO NOOOOOOOOO i did 4 times what you said ... plz tell me is there any other way
ram
i dont want to die i want to live as life is beautiful :(
ram
can you send me your code?
Reena
do you know how to set frame of any control?
Reena
whenevr you put tableview.it will take over all screenhow setframe will help here can you show me
ram
//Add the search bar self.parentViewController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"w2eat_3.png"]];//Travelscroll.png #pragma mark serach bar //self.navigationItem.titleView=searchBar; self.tableView.tableHeaderView = searchBar; searchBar.barStyle=UIBarStyleBlackTranslucent; searchBar.showsCancelButton=YES;
ram
Reena
NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO i am using tableview (drag n drop to my rootviewcont then inside table view i put serachbar this bar is on top and table view is aleready der,,, though i made another view with new search bar and table view with all those gap its not working HEY BHAGWAN UTHA LE
ram
that means controller which contains the table is UiTableViewControler.not UiViewControler. You need to specify this.You can't add any control in UiTableViewControler. To do that you have to take UiVIewController.
Reena
sari ramayan pad li aor aap puch rahi ho sita kon thi ... sahi ha :-)
ram