Q: How do I add UISearchBar to this? I want to add a UISearchBarto the following code below, that I am using in Xcode 4.6.
Can someone please help me?
// 

#import "SocialMasterViewController.h"

#import "SocialDetailViewController.h"

@interface SocialMasterViewController () {
    NSXMLParser *parser;
    NSMutableArray *feeds;
    NSMutableDictionary *item;
    NSMutableString *title;
    NSMutableString *link;
    NSString *element;
    NSArray *filteredStrings;
}
@end

@implementation SocialMasterViewController



-(void)gotosharing {
    UIStoryboard *sharingStoryboard = [UIStoryboard storyboardWithName:@"Sharing" bundle:nil];
    UIViewController *initialSharingVC = [sharingStoryboard instantiateInitialViewController];
    initialSharingVC.modalTransitionStyle = UIModalTransitionStylePartialCurl;
    [self presentViewController:initialSharingVC animated:YES completion:nil];
     }


- (void)awakeFromNib
{
    [super awakeFromNib];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    feeds = [[NSMutableArray alloc] init];
    NSURL *url = [NSURL URLWithString:@"http://www.rssmix.com/u/3735817/rss.xml"
            ];
    parser = [[NSXMLParser alloc] initWithContentsOfURL:url];
    [parser setDelegate:self];
    [parser setShouldResolveExternalEntities:NO];
    [parser parse];

    UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
    [refreshControl addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventValueChanged];
    [self.tableView addSubview:refreshControl];

}

- (void)refresh:(UIRefreshControl *)refreshControl {
    [refreshControl endRefreshing];
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table View

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return feeds.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
    cell.textLabel.text = [[feeds objectAtIndex:indexPath.row] objectForKey: @"title"];
    return cell;




}

- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict {

    element = elementName;

    if ([element isEqualToString:@"item"]) {

        item    = [[NSMutableDictionary alloc] init];
        title   = [[NSMutableString alloc] init];
        link    = [[NSMutableString alloc] init];

    }

}

- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {

    if ([elementName isEqualToString:@"item"]) {

        [item setObject:title forKey:@"title"];
        [item setObject:link forKey:@"link"];

        [feeds addObject:[item copy]];

    }

}

- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {

    if ([element isEqualToString:@"title"]) {
        [title appendString:string];
    } else if ([element isEqualToString:@"link"]) {
        [link appendString:string];
    }

}

- (void)parserDidEndDocument:(NSXMLParser *)parser {

    [self.tableView reloadData];

}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([[segue identifier] isEqualToString:@"showDetail"]) {

        NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
        NSString *string = [feeds[indexPath.row] objectForKey: @"link"];
        [[segue destinationViewController] setUrl:string];

    }
}






- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
{
    [self filterURLsWithSearchBar:searchText];
    [self.tableView reloadData];
}

- (void)filterURLsWithSearchBar:(NSString *)searchText
{
    //[filteredStrings removeAllObjects];
    for (NSString *rssUrl in feeds)
    {
        NSComparisonResult result = [rssUrl compare:searchText
                                            options:(NSCaseInsensitiveSearch|NSDiacriticInsensitiveSearch)
                                              range:[rssUrl rangeOfString:searchText options:(NSCaseInsensitiveSearch|NSDiacriticInsensitiveSearch)]];
        if (result == NSOrderedSame) {
            [self->feeds addObject:filteredStrings];
        }
    }
}

@end

Basically, I am want to filter the results of what is brought in by the NSXMLParser into search terms as they are typed into a search bar. 
Any help is much appreciated from you guys/gals.

A: Do this


*

*Store the value get from parser into an array. responseArray

*Use another array to store the value to show in table
datasourceArray

*After webvservice recieve successful response datasourceArray=responseArray then reload table with [tableView reloadData]

*When search starts,search from responseArray load the result into DatasourceArray then call reloadData again


A: you can use textFeildDidBegunEditingdelegate method of uitextFeild
then this code will help you filter
    NSMutableArray  *array1=(NSMutableArray*)[txtEditFavoriteColor.text componentsSeparatedByString:@" "];//words from textFeild

      for (NSString *str in array1) 
        {
            NSString *tempStr = [str stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
            if([tempStr length])
            {
                [arryOfWordsToBeSearched addObject:tempStr]; 

            }
        }



        NSMutableArray *subpredicates = [NSMutableArray array];

        for(NSString *term in arryOfWordsToBeSearched) {
            NSPredicate *p = [NSPredicate predicateWithFormat:@"name contains[cd] %@",term];
            [subpredicates addObject:p];
        }

        NSPredicate *filter = [NSCompoundPredicate andPredicateWithSubpredicates:subpredicates];
//***************************************************************predicate made above******
        result = [[NSMutableArray alloc]initWithArray:[arryOfDummyData filteredArrayUsingPredicate: filter]];//search on data array using predicate


A: Create table view controller subclass with nibfile. Add search bar to nibfile at top of table view. Then search result view controller will be added automatically. 
 most of the property of searchResultViewController like delegate, searchBar ,searchDisplayDatasource and delegate are automatically set. and also for search bar delegate is set as file owner.
Now implement table view conform to this protocol . . 
Implement the following delegate method .
- (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString
{
// create the array of ur search result object
}

now implementing tableViewDataSource and delegate check which table is calling method 
as follows 
if (tableView == self.searchDisplayController.searchResultsTableView)
{
    // searchResultsTableView
}
else
{
    // main table view
}

implement the corresponding code.
