跳到主要內容

hackingwithswift p2 guess the flag實作

一開始先Auto layout 三個按鈕

1x 2x 3x的img set 說明

set @IBOutlet
change the border width and color

import GameplayKit

countries = GKRandomSource.sharedRandom().arrayByShufflingObjects(in: countries) as! [String]

correctAnswer = GKRandomSource.sharedRandom().nextInt(upperBound: 3)


重要    三個Btn需call同一個@IBAction並設Btn的tag 0 , 1 , 2
@IBAction func buttonTapped(_ sender: UIButton) {
}

留言