Friday, July 8, 2011

Dev Juice: Help me create a hidden logo

Dear Dev Juice,

How do you implement that slightly egotistical Apple logo hidden in if you drag the bookshelf down from the top?

Brandon E.

Dear Brandon

Ah. You speak of the hidden drag-to-reveal logo. Actually, that's super-easy to do. Just remember that you can add subviews to scroll views and place them in that magic elastic zone at the top.

Take tables for example. Lots of devs now add "pull-to-refresh" feature to the top, similar to Apple's logo. As with the scrollview, make sure to set the origin above the normal start, i.e. use negative numbers of at least the size of whatever view you add.

Here's the basic approach. Adapt it as needed.

// Add the "Pull to Refresh" above the table.
// Ensure bounces and alwaysBounceVertical are enabled.
UIView *pullView = [[[NSBundle mainBundle]
owner:self options:nil] lastObject];
pullView.frame = CGRectOffset(pullView.frame, 0.0f,
[self.tableView addSubview:pullView];

Happy developing!

Dev Juice: Help me create a hidden logo originally appeared on TUAW - The Unofficial Apple Weblog on Wed, 06 Jul 2011 11:00:00 EST. Please see our terms for use of feeds.

Source | Permalink | Email this | Comments


No comments:

Post a Comment