title: UISearchBar in storyboard Xcode
body: <p>I want to create searchBar for my table in storyboard xcode, everythings works for me and I don't have any error, just search doesn't work.</p>
  
  <p>I saw this two tutorial but still doesn't work. I cann't search.
  my tutorial:</p>
  
  <pre><code>   -http://stackoverflow.com/questions/9897171/uisearchbar-implemented-with-storyboards
     -http://www.youtube.com/watch?v=IqDZHgI_s24
  </code></pre>
  
  <p>would you please help me,
  Thanks in Advance!</p>
  
  <p>Here is my code </p>
  
  <p>CreateViewController.h</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @interface CreateViewController : UITableViewController &lt;UITableViewDelegate, UITableViewDataSource,       UISearchBarDelegate&gt;
  {
  // @property (weak, nonatomic) IBOutlet UISearchBar *searchBar;
  NSArray *datas;
  NSMutableArray *displayItems;
  IBOutlet UITableView * tableView;
  IBOutlet UISearchBar * searchbar;
  }
  
  @end
  </code></pre>
  
  <p>CreateViewController.m</p>
  
  <pre><code>#import "CreateViewController.h"
  
  @interface CreateViewController ()
  
  @end
  
  @implementation CreateViewController
  
  - (id)initWithStyle:(UITableViewStyle)style
  {
  self = [super initWithStyle:style];
  if (self) {
      // Custom initialization
  }
  return self;
  }
  
  - (void)viewDidLoad
  {
  [super viewDidLoad];
  
  datas = [NSMutableArray arrayWithObjects:@"Johan", @"Paul",@"George",@"Ringo", nil];
  displayItems = [[NSMutableArray alloc] initWithArray:datas];
  [super viewDidLoad];
  }
  
  - (void)viewDidUnload
  {
  [super viewDidUnload];
  // Release any retained subviews of the main view.
  // e.g. self.myOutlet = nil;
  }
  
  - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
  {
  return (interfaceOrientation == UIInterfaceOrientationPortrait);
  }
  
  #pragma mark - Table view data source
  
  - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  {
  // Return the number of sections.
  return 1;
  }
  
   - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  {
  // Return the number of rows in the section.
  return [datas count];
  }
  
  - (UITableViewCell *)tableView:(UITableView *)atableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
  static NSString *CellIdentifier = @"Cell";//This is the identifier in storyboard    
  UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  if(!cell) {
      cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"];
  }
  
  cell.textLabel.text = [datas objectAtIndex:indexPath.row];
  return cell;
  }
  -(void)searchbar:(UISearchBar *)searchbar textDidChange:(NSString *)searchText{
  if([searchText length] == 0){
      [displayItems removeAllObjects];
      [displayItems addObjectsFromArray:datas];
  }else{
      [displayItems removeAllObjects];
      for(NSString * string in datas){
          NSRange r = [string rangeOfString:searchText options:NSCaseInsensitiveSearch];
          if (r.location != NSNotFound){
              [displayItems addObject:string];   
          }
      }
  }
  [tableView reloadData];
  }
  
   #pragma mark - Table view delegate
  
   - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
   {
  // Navigation logic may go here. Create and push another view controller.
  /*
   &lt;#DetailViewController#&gt; *detailViewController = [[&lt;#DetailViewController#&gt; alloc] initWithNibName:@"&lt;#Nib    name#&gt;" bundle:nil];
   // ...
   // Pass the selected object to the new view controller.
   [self.navigationController pushViewController:detailViewController animated:YES];
   */
  }
  
  @end
  </code></pre>