“AFInformationView” Bubbles on the iPhone
My iPhone application, Presenter, lets the user choose whether they want to swipe, tap, or use buttons to change slides. The Settings panel contains a 3 button segmented control to customize this behavior on the fly. Instead of including a help screen or inserting a large UILabel underneath the segmented control, I wrote a class that displays a floating UILabel on top of each button when selected.
Calling this helper class is very simple. Pass in the target view, location, label text and a few other parameters.
- (void)displayInView:(UIView *)theView withText:(NSString *)displayText atLocation:(CGPoint)location width:(CGFloat)width isTriangleOnTop:(Boolean)isTriangleOnTop triangleHorizontalLocation:(CGFloat)triangleHorizontalLocation forDuration:(NSTimeInterval)duration;
AFInformationView will fade in a multi-line, semi-transparent, black label with rounded corners & a target triangle. The label’s text will wrap and grow vertically, depending on its width. After a specified amount of time, the label again fades out. If the user taps on the label, it fades out immediately.
I have included a sample Xcode project demonstrating its use.
http://fajkowski.com/code/AFInformationView/AFInformationView.zip
Click here to see a short video of the Xcode project in use.
I have released the code with an MIT license. Feel free to reuse it in any project you’d like.
About this entry
You’re currently reading ““AFInformationView” Bubbles on the iPhone,” an entry on Alex Fajkowski
- Published:
- 6.22.09 / 1pm
- Category:
- Open Source, Software Development, iPhone

No comments
Jump to comment form | comments rss [?] | trackback uri [?]