The answer was to add a search string to the view before running the rest of the code.
UISearchBar * tempSBar = [[UISearchBar alloc] initWithFrame:CGRectZero]; self.sBar = tempSBar; [tempSBar release]; [self.view addSubview:sBar]; [sBar sizeToFit]; sBar.delegate = self; sBar.autoresizingMask = UIViewAutoresizingFlexibleWidth |UIViewAutoresizingFlexibleBottomMargin;
source share