Searchbar and iPad simulator issues??

Discussion in 'iOS Programming' started by mraheel, Jul 17, 2010.

  1. mraheel macrumors regular

    Apr 18, 2009
    This is a very strange issue with iPad simulator, my app isnt "Designed for iPad" its just compatible.. like all other apps.

    But the problem arrives when adding UISearchBar with "Cancel" button. It works fine on iPod Device - iOS4, And previously tested on iPod 3.0.. i used to see the cancel button just fine.

    But with the new Xcode when deploying on iPad Simulator, i dont see the "Cancel" button next to the SearchBar in the navigationitem's titleView.

    Im wondering if this is a bug in the simulator?? or theres something wrong with how im doing it.

    	self.mySearchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, self.navigationController.navigationBar.frame.size.width, 0)];  
    	mySearchBar.delegate = self;  
    	mySearchBar.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
    	mySearchBar.placeholder = @"SearchText";
    	[B]mySearchBar.showsCancelButton = YES;[/B]
    	mySearchBar.tintColor = self.navigationController.navigationBar.tintColor;
    	mySearchBar.scopeButtonTitles = [NSArray arrayWithObjects:@"Case Sensitive", @"Case Insensitive", nil]; 
    	mySearchBar.showsScopeBar = YES;
    	[mySearchBar sizeToFit];  
    Also, I added the scopeBar.. and again, i dont see it in iPad simulator, while its just fine on iPhone/iPhone4 Simulators and Device.

    Should i be testing this on a 3.0 device? I'll have to restore to 3.0 device..

    To add to this, i've reset the Simulator, recompiled, redid everything, still I see no CANCEL button adjacent to the searchBar and no scopeBar below it. So, Efectively going to search is a point of no return. (Cant tap cancel and remove searchBar).
    NOTE: this only happens on iPad Simulator, iPhone4/iPhone simulator and iPodT device with iOS4 work just fine..
  2. ErikCarlson macrumors newbie

    Aug 17, 2010
    London, UK
    any solution

    Hi There,

    I'm having the same problem with an App I'm porting to iPad, and it's really frustrating me. Seems to be the same whether I put the search bar in a navigation bar (as it was on the iPhone App) on in a UI Toolbar (as you are now allowed to do for the first time on the iPad).

    If you did find a solution I would be really glad to hear it!


Share This Page