PDA

View Full Version : More IB linking questions, buttons in custom cells?




dantastic
Feb 4, 2011, 09:04 AM
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;
break;
}
}
}


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.