开发者

can i make the searchbar static in iphone application

开发者 https://www.devze.com 2023-01-06 10:17 出处:网络
I want that searchbar should also scroll with scrolling mean when i scroll down searchbar should be visible.

I want that searchbar should also scroll with scrolling mean when i scroll down searchbar should be visible. as there anyw开发者_如何学Goay to do so... thanks. and sorry for my bad english..


If I understand you correctly, this is what you should do:

Open up the interface builder and make the SearchBar the child of the table view if you want it to scroll along with the contents. If you need it to be always visible, drag it out of the tableview.


Well you can also simply do that

SearchBar =[[UISearchBar alloc]initWithFrame:CGRectMake(10, 5, 300, 50)];
    SearchBar.tintColor=[UIColor blackColor];
    [SearchBar setDelegate:self]; 
    //[self.view addSubview:search];


    table=[[UITableView alloc]initWithFrame:CGRectMake(0, 15, 320, 480) style:UITableViewStyleGrouped];
    table.delegate=self;
    table.dataSource=self;
    table.backgroundColor=[UIColor darkGrayColor];
    table.tableHeaderView=SearchBar;
    [self.view addSubview:table];
0

精彩评论

暂无评论...
验证码 换一张
取 消