iOS 7’s Subtle UITableView View Hierarchy Changes

While updating one of my oldest apps to iOS 7, I noticed that I was getting an exception when trying to grab a UITableViewCell from a UITableView. The code looked something like this:

- (IBAction)OnSomeReallyImportantStepperChanged:(id)sender
{
    UIStepper* stepper = sender;

    UITableViewCell* cell = (UITableViewCell*)[[stepper superview] superview];
    UITableView* table = (UITableView *)[cell superview];
    NSIndexPath* pathOfTheCell = [table indexPathForCell:cell]; // ***BOOM***

This code worked in iOS 6 and below, but threw an exception in iOS 7:

[UITableViewCell indexPathForCell:]: unrecognized selector sent to instance

What’s going on here? Well, a quick debugging session made it quite clear. cell is actually a UITableViewCellScrollView, not a UITableViewCell, and table is really a UITableViewCell, so naturally it didn’t have an indexPathForCell method.

The moral of the story is – don’t make too many assumptions about the view hierarchy, because it may change!

One Comment

  1. – tab / Coins

    After you deposit the maintenance that you deposited will become
    financial credit or coins in the online slot gambling.
    bank account or coin is what you can progressive
    use to bet and usually credit or coin can be found in the subjugate left corner of the robot or online slot
    screen.

    – Jackpot

    The biggest prize you can get considering you win a slot is called the jackpot.
    Usually players can win the jackpot once betting maximum on each
    round. information on the number of winning jackpots can be seen in the
    paytable / payment table.

    – Pay table

    In every online gambling, you will locate pages or sections that portray what he can get in the slot game.
    in video slots usually on the screen, the payment table will sham you how to start bonuses or how
    further betting features law in the manner of scatter or wild symbols.

    – unconventional Jackpot

    Progressive jackpots by yourself exist on a number of specific machines and are owned by
    one provider. The provider will pay the dealer or agent where
    the game is visceral marketed. A unconventional jackpot
    will slowly layer next won by the player.

    That’s how many terms you have in slot games that you should know about,
    you can look in more detail in the information middle in the online slot games that you play.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *