项目源地址 : https://github.com/andreamazz/AMPopTip
引用文件 在附件 通过 Bridging 文件
#import "AMPopTip.h"
引入
1, 显示文字
import UIKit
class ViewController: UIViewController {
var pop:AMPopTip?;
@IBAction func btn1(sender: UIButton) {
pop?.showText("hilll sdfsd sdf ", direction: .Down, maxWidth: 600, inView: self.view, fromFrame: CGRect(x: 0, y: 0, width: 110 , height: 110));
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
self.pop = AMPopTip();
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
2,嵌入 自定义的 视图
import UIKit
class ViewController: UIViewController {
var pop:AMPopTip?;
@IBAction func btn1(sender: UIButton) {
let changeViewMain = UIView(frame: CGRectMake(0, 0, 300, 200));
changeViewMain.backgroundColor = UIColor.redColor();
//
pop?.showCustomView(changeViewMain, direction: .Down, inView: self.view, fromFrame: CGRect(x: 0, y: 0, width: 200, height: 140));
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
self.pop = AMPopTip();
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
3, 隐藏 , pop.hide();
请发表评论