Created
December 1, 2013 22:29
-
-
Save dastels/7741713 to your computer and use it in GitHub Desktop.
test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (let ((balance 0) | |
| (root (tap (UIView.) | |
| (.frame= (list '(0 0) | |
| (list (-> *device* .screen .width) | |
| (-> *device* .screen .height)))) | |
| (.backgroundColor= (UIColor/whiteColor)))) | |
| (balance-label (tap (UILabel.) | |
| (.frame= '((10 10) (80 75))) | |
| (.text= "Balance"))) | |
| (balance-field (tap (UILabel.) | |
| (.frame= '((100 10) (300 75))) | |
| (.font= (UIFont/fontWithName:size: "Arial-BoldMT" 18)) | |
| (.text= (str balance)))) | |
| (update (lambda () | |
| (tap balance-field | |
| (.text= (str balance)) | |
| (.textColor= (if (< balance 0) | |
| (UIColor/redColor) | |
| (UIColor/blackColor)))))) | |
| (input-label (tap (UILabel.) | |
| (.frame= '((10 100) (80 50))) | |
| (.text= "Value"))) | |
| (input (tap (UITextField.) | |
| (.frame= '((100 100) (100 50))) | |
| (.backgroundColor= (UIColor/lightGrayColor)))) | |
| (deposit-button (tap (UIButton/buttonWithType: UIButtonTypeSystem) | |
| (.frame= '((10 200) (200 50))) | |
| (.setTitle:forState: "Deposit" UIControlStateNormal) | |
| (.when UIControlEventTouchUpInside | |
| (lambda () | |
| (set! balance (+ balance (integer (.text input)))) | |
| (update))))) | |
| (withdraw-button (tap (UIButton/buttonWithType: UIButtonTypeSystem) | |
| (.frame= '((250 200) (200 50))) | |
| (.setTitle:forState: "Withdraw" UIControlStateNormal) | |
| (.when UIControlEventTouchUpInside | |
| (lambda () | |
| (set! balance (- balance (integer (.text input)))) | |
| (update))))) | |
| (close-button (tap (UIButton/buttonWithType: UIButtonTypeSystem) | |
| (.frame= '((10 300) (600 50))) | |
| (.setTitle:forState: "Close" UIControlStateNormal) | |
| (.when UIControlEventTouchUpInside | |
| (lambda () | |
| (.removeFromSuperview root)))))) | |
| (tap root | |
| (.addSubview balance-label) | |
| (.addSubview balance-field) | |
| (.addSubview input-label) | |
| (.addSubview input) | |
| (.addSubview deposit-button) | |
| (.addSubview withdraw-button) | |
| (.addSubview close-button)) | |
| (.addSubview (.window *app*) root)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment