-2
我有一個編程式的按鈕,我想將它連接到一個動作,以便它在我點擊它時直接進入另一個視圖。通常我只是控制+拖動。但我不能編程式製作。如何將此代碼鏈接到我的「ViewController」,所以當我點擊它時,ViewController(登錄屏幕)彈出。Swift Link按鈕到控制器
的代碼是在這裏,它從https://github.com/mamaral/Onboard
let thirdPage: OnboardingContentViewController = OnboardingContentViewController(title: "Seriously Though", body: "Kudos to the photographer.", image: UIImage(named:"yellow"), buttonText: "Let's Get Started"){ //Enter Action Here//
我不知道是否這部分是要幫助你,但我會爲了以防萬一
if (countElements(self.buttonText) != 0) {
var actionButton: UIButton = UIButton(frame: CGRectMake((CGRectGetMaxX(self.view.frame)/2) - (contentWidth/2), CGRectGetMaxY(self.view.frame) - kDefaultMainPageControlHeight - kDefaultActionButtonHeight - self.bottomPadding, contentWidth, kDefaultActionButtonHeight))
actionButton.titleLabel?.font = UIFont .systemFontOfSize(24)
actionButton.setTitle(self.buttonText, forState: .Normal)
actionButton.setTitleColor(self.buttonTextColor, forState: .Normal)
actionButton.addTarget(self, action: "handleButtonPressed", forControlEvents: .TouchUpInside)
self.view.addSubview(actionButton)
永遠不要發送鏈接到github回購。沒有人會瀏覽你的所有代碼。確定你的問題。 – michaelsnowden 2014-09-20 10:20:07