SegFault
SegFault

Reputation: 1094

How to make a menu looking like the one in QuizUp

I gave a look on QuizUp and I would like to make a similar menu on my iphone application.

I don't understand how they made the menu. It looks like a table view controller, but a new menu appears under the cell when the user tap on it.

Can someone give me some clues. Is it possible to do that with the native iOS SDK ? How ?

Upvotes: 0

Views: 414

Answers (1)

Craig Siemens
Craig Siemens

Reputation: 13276

According to the developer of Quiz Up, the app was made using Cocos2D.

That being said, it is also possible to do it using a UITableView. Theres just a couple things you would need to do. The first is get tableView:heightForRowAtIndexPath: to return a different height for the row(s) you want to be expanded. For example, if you only want one row expanded you could use the following.

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if ([[tableView indexPathForSelectedRow] isEqual:indexPath]) {
        return 100.0f;
    }
    return 44.0f;
}

Then what you need to do is call beginUpdates and endUpdates on your tableview whenever you want the height to update.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView beginUpdates];
    [tableView endUpdates];
}

After that, you just need to layout your cell so that when it's expanded, it shows the additional view and when its collapsed it should hide that view.

Upvotes: 2

Related Questions