More IB linking questions, buttons in custom cells?

Discussion in 'iPhone/iPad Programming' started by dantastic, Feb 4, 2011.

  1. macrumors 6502


    Jan 21, 2011
    Hi again,

    I'm still trying to get my head around IB.

    I am currently creating UITableViewCells programmatically.

    In a UIView I have a UITableView
    The cells have a label and 8 buttons. Each button has a different image for it's normal state.

    If a button inside the UITableViewCell gets pressed I've a function to change the image for it's normal state.

    This is working.

    In my quest to understand this better I want to do this slightly differently.

    I have created a custom UITableViewCell, with nib. I'm loading it as:
    TeamSelectionCell *cell = [self.tableView dequeueReusableCellWithIdentifier:TeamSelectionCellIdentifier];
    			if (cell == nil) {
    				NSArray *objectList = [[NSBundle mainBundle] loadNibNamed:@"TeamSelectionCell" owner:self options:nil];
    				for (id currentObject in objectList) {
    					if([currentObject isKindOfClass:[UITableViewCell class]]){
    						cell = (TeamSelectionCell *)currentObject;
    It loads. I've been able to get the buttons to talk to the correct function when pressed. The nameLabel is correct as well for each cell.

    How can I change the background image of the buttons? I have been looking for hours but I haven't been able to find anything that explains how you can modify objects within a custom uitableviewcell like this.

Share This Page