PTBalloonView and PTBalloonLabel are the view and label, like balloon. It is easy to use this balloon view and label. And it can be set balloon's inflating and deflating animations.
PTBalloonView | PTBalloonLabel |
---|---|
PTBalloonView is a simple popup view like a balloon. The contentView
property is used for your view to be shown in a balloon.
PTBalloonLabel is a simple popup label, which is subclass of PTBalloonView. It have additional properties, title, text, and buttons, instead of contentView.
iOS 8.0
PTBalloonView is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "PTBalloonView"
At first, to popup balloon view is only code below. (shows empty balloon.)
let balloonView = PTBalloonView()
balloonView
.contentView(UIView(frame: CGRectMake(0, 0, 120, 80))) // replace to your content view
.inflate(TARGET_VIEW) // replace TARGET_VIEW to target view
and deflate balloon is only code below.
balloonView.deflate()
To popup PTBalloonLabel.
let balloonLabel = PTBalloonLabel()
balloonLabel
.title("PTBalloonLabel Demo")
.text("This balloon is PTBalloonLabel Demo")
.addButton(title: "close", type: .Close)
.inflate(TARGET_VIEW) // replace TARGET_VIEW to target view
Details, see the Demo and the Class Reference.
To change balloon's style, you can use methods (named same as properties).
To change balloon's animations, inflateAnimation()
and deflatingAnimation()
methods can be used.
To run the example project, clone the repo, and run pod install
from the Example directory first.
Balloon's pumping up and deflating animations can be selected.
Pop | PopShift | Fade |
---|---|---|
FadeShift | Revolution | RevolutionShift |
---|---|---|
Slide (can choose direction) |
---|
Target view's animations can be selected also. (It applies only when balloon inflating.)
Pop | Blink | Rotation | Sway |
---|---|---|---|
Takeshi Watanabe, [email protected]
PTBalloonView is available under the MIT license. See the LICENSE file for more info.