1、导航栏按钮
UIBarButtonItem(
title: "Some Title",style: UIBarButtonItemStyle.Done,target: self,action: "flatButtonpressed:"
) 2、普通按钮
flatButton.addTarget(self,action: "flatButtonpressed:",forControlEvents: UIControlEvents.TouchUpInside)
func flatButtonpressed(sender: AnyObject) { NSLog("flatButtonpressed") }
3、timervar timer = NSTimer.scheduledTimerWithTimeInterval(1.0,selector: Selector("flatButtonpressed"),userInfo: userInfo,repeats: true) let mainLoop = NSRunLoop.mainRunLoop() //1 mainLoop.addTimer(timer,forMode: NSDefaultRunLoopMode) //2 this two line is optinalfunc flatButtonpressed(timer: NSTimer) { }