Skip to content

Commit

Permalink
change colour + readme Tutorial 2
Browse files Browse the repository at this point in the history
  • Loading branch information
ndtran committed Apr 13, 2017
1 parent 11900b8 commit f7d5963
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
5 changes: 4 additions & 1 deletion README.md
Expand Up @@ -2,4 +2,7 @@
iOS App Programmatically

## Tutorial1
[Set up the project](https://tomylab.wordpress.com/2017/03/08/ios-app-programmatically-setup-the-project/)
[Set up the project](https://tomylab.wordpress.com/2017/03/08/ios-app-programmatically-setup-the-project/)

## Tutorial2
[UILabel, UITextfield, UIButton](https://tomylab.wordpress.com/2017/04/10/ios-app-programmatically-uilabel-uitextfield-and-uibutton/)
Binary file not shown.
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "1"
version = "2.0">
</Bucket>
14 changes: 10 additions & 4 deletions Tutorial2/MyApp/MyApp/ViewController.swift
Expand Up @@ -20,12 +20,14 @@ class ViewController: UIViewController {
// MARK: - Initalisation

override func viewDidLoad() {
super.viewDidLoad()

self.view.backgroundColor = UIColor.cyan
let blueColor = UIColor(red: 0.0/255.0, green: 118.0/255.0, blue: 255.0/255.0, alpha: 1.0)
self.view.backgroundColor = blueColor

/* label */
self.label.text = "What's your name ?"
self.label.textColor = UIColor.red
self.label.textColor = UIColor.white
self.label.textAlignment = .center
self.label.font = UIFont(name: "HelveticaNeue-Bold", size: 18)
self.label.translatesAutoresizingMaskIntoConstraints = false
Expand Down Expand Up @@ -75,7 +77,7 @@ class ViewController: UIViewController {
self.view.addSubview(self.button)

/* label 2 */
self.label2.textColor = UIColor.red
self.label2.textColor = UIColor.black
self.label2.textAlignment = .center
self.label2.font = UIFont(name: "HelveticaNeue-Bold", size: 18)
self.label2.translatesAutoresizingMaskIntoConstraints = false
Expand Down Expand Up @@ -117,7 +119,11 @@ class ViewController: UIViewController {
}

func buttonAction(sender: UIButton) {
self.label2.text = self.textfield.text
guard let name = self.textfield.text else {
self.label2.text = ""
return
}
self.label2.text = "Your name is " + name
}

}
Expand Down

0 comments on commit f7d5963

Please sign in to comment.