-
parameters查看全部
-
swapTwoInts查看全部
-
func查看全部
-
numberOfSections pngImageData.write addQuadCurve WKInterfaceDevice.current查看全部
-
var str append appending查看全部
-
Swift Document查看全部
-
API命名规则查看全部
-
click()查看全部
-
import UIKit import PlaygroundSupport class ViewController: UIViewController{ override func viewDidLoad(){ super.viewDidLoad() self.view.backgroundColor = UIColor.yellow self.view.frame = CGRect(x: 0, y: 0, width: 300, height: 400) let button: UIButton = UIButton(frame: CGRect(x: 0, y: 0, width: 80, height: 40)) button.center = self.view.center button.setTitle("click me!", for: .normal) button.setTitleColor(.blue, for: .normal) button.addTarget(self, action:"click", for: .touchUpInside) button.addTarget(self, action:#selector(click), for: .touchUpInside) self.view.addSubview(button) } func click(){ if view.backgroundColor == .yellow { view.backgroundColor = .cyan } else { view.backgroundColor = .yellow } } }查看全部
-
import UIKit import PlaygroundSupport class ViewController: UIViewController{ override func viewDidLoad(){ super.viewDidLoad() self.view.backgroundColor = UIColor.yellow self.view.frame = CGRect(x: 0, y: 0, width: 300, height: 400) let button: UIButton = UIButton(frame: CGRect(x: 0, y: 0, width: 80, height: 40)) button.center = self.view.center button.setTitle("click me!", for: .normal) button.setTitleColor(.blue, for: .normal) button.addTarget(self, action:"click", for: .touchUpInside) button.addTarget(self, action:#selector(click), for: .touchUpInside) self.view.addSubview(button) } }查看全部
-
import UIKit let score1 = (chinese: 90, math: 95) let score2 = (chinese: 90, math: 100) let score3 = (chinese: 100, math: 90) fun printScore(chinese: Int, math: Int){ print("Chinese score: \(chinese), math score: \(math)") } //printScore(score1) printScore(chinese: score1.chinese, math: score1.math)查看全部
-
import UIKit let score1 = (chinese: 90, math: 95) let score2 = (chinese: 90, math: 100) let score3 = (chinese: 100, math: 90) func < (t1: (Int, Int), t2: (Int, Int)) -> Bool { if t1.1 != t2.1 { return t1.1 < t2.1 } return t1.0 < t2.0 } score1 < score2 true score3 < score2 true查看全部
-
for i in stride(from: 10, through: 0, by: -2){ print(i) }查看全部
-
for i in stride(from:0, through:10, by:2){ print(i) }查看全部
-
for i in stride(from:0, to:10, by:2){ print(i) }查看全部
举报
0/150
提交
取消