• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Trying to customize UITableViewCell with IB but having odd exception
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trying to customize UITableViewCell with IB but having odd exception


  • Subject: Trying to customize UITableViewCell with IB but having odd exception
  • From: James West <email@hidden>
  • Date: Sat, 28 Jan 2012 00:55:54 -0600

In two classes, I've subclassed UITableViewCell in order to do some major customization. I'd like to use a Xib file to keep the amount of UI layout code to a minimum. I'm coming across an odd exception:

    if (!cell) {
        if (indexPath.row == 0) {
            cell = [[[SearchCellTop alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier] autorelease];
            NSArray* objects = [[NSBundle mainBundle] loadNibNamed:@"SearchCellTop" owner:cell options:nil];
            cell = (SearchCellTop*)[objects objectAtIndex:0];
        }
        else {
            cell = [[[SearchCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier] autorelease];
            NSArray* objects = [[NSBundle mainBundle] loadNibNamed:@"SearchCell" owner:cell options:nil];
            cell = (SearchCell*)[objects objectAtIndex:0];
        }
    }

This seems to work well for loading the Xibs. However as soon as I try doing something such as:

    if (indexPath.row < [self tableView:tableView numberOfRowsInSection:indexPath.section])
        ((SearchCell*)cell).Product = [products objectAtIndex:indexPath.row];

I get -[UIAccessibiltyBundle setProduct:] unrecognized selector sent to instance

Everything indicates that 'cell' is of the correct type, however I'm still getting this error.

(SearchCellTop is a subclass of SearchCell)

--
James West
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Trying to customize UITableViewCell with IB but having odd exception
      • From: Phillip Mills <email@hidden>
  • Prev by Date: Blocks and Methods...
  • Next by Date: Re: How to get the dispatch queue for the current thread's runloop?
  • Previous by thread: Re: Blocks and Methods...
  • Next by thread: Re: Trying to customize UITableViewCell with IB but having odd exception
  • Index(es):
    • Date
    • Thread