Simple custom user notifications
(DEPRECATED AND NO LONGER MAINTAINED.)
- Copy the file
SFSwiftNotification.swift
into your project.
In your ViewController
var notificationView: SFSwiftNotification?
In viewDidLoad()
notificationView = SFSwiftNotification(frame: CGRectMake(0, 0, CGRectGetWidth(self.view.frame), 50),
title: "This is an SFSwiftNotification",
animationType: .Collision,
direction: .RightToLeft,
delegate: self)
notificationView!.backgroundColor = UIColor.orangeColor()
notificationView!.label.textColor = UIColor.whiteColor()
self.view.addSubview(notificationView!)
To start the notification:
@IBAction func notify(sender : AnyObject) {
self.notificationView!.animate(1)
}
AnimationTypes:
.Collision
.Bounce
Directions:
.TopToBottom
.LeftToRight
.RightToLeft