Need help implementing searchbar for my table. App works, no search though.

Discussion in 'iOS Programming' started by dalearyous, Oct 24, 2010.

  1. dalearyous macrumors newbie

    Oct 24, 2010
    i have been all over the place and struggling with this for days. I cannot for the life of me get a search bar up and working for my tableview. i would love for someone to take a look at my project and help me get started. i would like a search like the tablesearch example on apple's website.
  2. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    You're going to need to be a lot more specific about what you've already tried, what isn't working, etc. So far what you've provided is far too vague to even begin to make any sort of diagnosis.
  3. dalearyous thread starter macrumors newbie

    Oct 24, 2010
    so i think my problem might be in interface builder. i wil try to post enough code here so you guys get a sense of what i need.

    i have a model.h and a model.m which defines the array that populates table:
    #import "physicianModel.h"
    @implementation physicianModel
    @synthesize physician;
    @synthesize physicianImages;
    - (id) init {
    	self = [super init];
    	NSMutableArray *tmpPhysicians = [[NSArray alloc] initWithObjects:
    	self.physician = tmpPhysicians;
    	[tmpPhysicians release];
    	NSMutableArray *tmpImages = [[NSArray alloc] initWithObjects:
    								 @"name1.png", @"name2.png", @"name3.png", nil];
    	self.physicianImages = tmpImages;
    	[tmpImages release];
    	return self;
    - (int)getNumberOfPhysicians {
    	return [physician count];
    - (NSString *)getPhysicianTitleAtIndex:(int)index {
    	return [physician objectAtIndex:index];
    - (UIImage *)getPhysicianImageAtIndex:(int)index {
    	UIImage *physicianImage = [UIImage imageNamed:[physicianImages objectAtIndex:index]];
    	return physicianImage;
    - (void) dealloc {
    	[physician release];
    	[physicianImages release];
    	[super dealloc];
    here is my physicianTableViewController.m
    - (void)viewDidLoad {
        [super viewDidLoad];
    	self.title = NSLocalizedString(@"Find A Physician", @"Your search results");
    	physicianModel *tmpPhysicianModel = [[physicianModel alloc] init];
    	self.PhysicianModel = tmpPhysicianModel;
    	[tmpPhysicianModel release];
    what i am trying to do is do a search JUST like the tablesearch example from apple's dev site. but i can't figure it out.

    first i try to go into interface builder and add a search bar but everytime i add it to my view it covers the entire view and puts the search bar in the middle of the screen, covering up my tableview.

    IB is still very confusing to me, well it all is but IB is my achilles heel

    any chance i could just email someone my project so they can understand better?
  4. dalearyous thread starter macrumors newbie

    Oct 24, 2010
    so i have sent my project to a few people i know that are WAY better at this than me and they are having issues.

    i think i might start over and attack this from the approach of starting with the tablesearch app apple made for tutorial and build in my tab bar delegate from there.

    so my question, can anyone give me some advice on how to use the tablesearch example from apple and have that entire app i guess load from one tab bar button and have another tab bar button just load an imageview or something for an about or something

Share This Page