您的位置:首页 > 其它

一些系统事件的手动触发方法

2016-10-08 16:26 375 查看

测试UIViewController

触发UIViewController生命周期中的事件

调用 UIViewController.view, 它会触发 UIViewController.viewDidLoad()。
调用 UIViewController.beginAppearanceTransition() 来触发大部分事件。
直接调用生命周期中的函数

手动触发UIControl Events

describe("the 'more bananas' button") {
it("increments the banana count label when tapped") {
viewController.moreButton.sendActionsForControlEvents(
UIControlEvents.TouchUpInside)
expect(viewController.bananaCountLabel.text).to(equal("1"))
}
}


文/俞子将(简书作者)
原文链接:http://www.jianshu.com/p/f13fc6aed467
著作权归作者所有,转载请联系作者获得授权,并标注“简书作者”。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: