// Playground - noun: a place where people can playimport Cocoavar str = "Hello, playground"/*閉包*/let names = ["chris","Alex","Ewa","Barry","Daniella"]func backwards(s1:String,s2:String)
這個是一個可愛的登入框頁面,動畫效果仿自國外網站readme.io。在GitHub上有人寫了個objective-C版本,這裡我翻譯成Swift版的分享給大家。 效果圖如下:(1)當輸入使用者名稱時,貓頭鷹的手是搭在登入框上(2)當輸入密碼時,貓頭鷹的手會遮住眼睛。這個是有動畫效果的。實現方式其實就是圖片移動動畫。(3)離開密碼框時,貓頭鷹手又會放下。 動態效果如下:import UIKit class
1,擷取當前月天數//計算當月天數func getDaysInCurrentMonth() -> Int { let calendar = NSCalendar.currentCalendar() let date = NSDate() let nowComps = calendar.components([.Year,
1. Swift枚舉基本概念 Swift中的枚舉比OC中的枚舉強大, 因為Swift中的枚舉是一等類型, 它可以像類和結構體一樣增加屬性和方法 格式: enum Method{ case 枚舉值} enum Method{ case Add case Sub case Mul case Div} 2. 枚舉的基本使用 可以枚舉值可以連著寫, 但是要以逗號,分隔 enum Menthod1
標籤:swift 動畫 1.動畫效果2.代碼//// AppDelegate.swift// AnimationDemo//// Created by 趙超 on 14-6-27.// Copyright (c) 2014年 趙超. All rights reserved.//import UIKit@UIApplicationMainclass AppDelegate: UIResponder,