views:

33

answers:

2
- (void)loadView 
{

       SettingsTitleBar=[[UINavigationController alloc] initWithRootViewController: self];
        searchBar =[ [UISearchBar alloc] initWithFrame:CGRectMake(0, 44, 320, 40)];
    searchBar.placeholder = @"Type your City Name";
    searchBar.delegate = self;
    searchBar.autocorrectionType = UITextAutocorrectionTypeNo;
    [searchBar setShowsCancelButton:YES];
    [SettingsTitleBar.navigationBar addSubview:searchBar];  
        self.view = [[UIView alloc]  initWithFrame:CGRectMake(0, 85, 320, 392)]; 
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 120, 320, 302)                                                         style: UITableViewStyleGrouped]; 
    [tableView setDelegate:self]; 
    [tableView setDataSource:self]; 
        [self.view addSubview:tableView];


}

I Have a UITableViewController, I have utilized the first 44 pixels height for title bar, and then the next 40 pixels of height for search bar(44+40). These are added as navigation controller subviews. then i am adding my self.view at 85 pixel from top, finally tableview has been added as child to the self.view . But table view has been overlapped with the Searchbar. I dont what is wrong with it. I tried to change various yPositions of tableview and self.view but still nothing happened. Can anyone able to help me out from this ?

Note : I dont want to add SearchBar into UITableviewHeader Section.

A: 

U can make the view of size 320X436 and add the tabble view and search bar in that view...

Suriya
That didn't work
muthukumar
I need to fix searchbar in solid position. If i do so it will be scrolled along with table view.
muthukumar
TRY USING THIS FRAMESself.view.frame=CGRectMake(0,0,320,436);searchbar.frame=CGRectMake(0,0,320,44);tableview.frame=CGRectMake(0,44,320,392);[self.view addSubview searchbar];[self.view addSubview tableview];
Suriya
A: 

I wouldn't add subviews to the navigationBar. Add it to the view.

As a sidenote: anything you alloc (or retain or copy), you should release or autorelease

mvds
I need to fix searchbar in solid position. If i do so it will be scrolled along with table view.
muthukumar