小说网 找小说 无限小说 烟雨红尘 幻想小说 酷文学 深夜书屋

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

测试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
著作权归作者所有,转载请联系作者获得授权,并标注“简书作者”。

posted on 2016-10-08 16:26  王峰炬  阅读(168)  评论(0编辑  收藏  举报

导航