How can i keep the uiSearch bar i created in Xcode 4.3.3 fixed on top while scrolling the table view? Any thoughts?
问题:
回答1:
EDITED: If u have used the Interface builder to add the search bar, make sure that it is not added as the subview of the tableview (this makes the search bar as a part of the table, which scrolls along with the table). Checkout the link below, and avoid it. This link shows how a search bar becomes a subview of the table. This is not what u want. Just drag the search bar outside of the Table view in ur interface builder, so that it becomes a part of the view.
I have added second image to show how u can find the solution to ur problem.
If u want to add the search bar programatically, then just add it as-
[self.view addSubview:mySearchBar];
Set the frame of this search bar accordingly.
回答2:
how did you create them in the nib file? do not put the search bar on the UITableView. they should be separated.You can put the search bar at the top of the tableview but not on it.