原创 自定義手勢+指定區域識別觸摸

import UIKit class ViewController: UIViewController { @IBOutlet weak var customGestureLabel: UILabel! @IB

原创 OC與Swift混編注意點

創建一個OC新工程 在其中創建一個Swift的文件 生產的test-Bridging-Header.h 爲OC橋接文件 ,Xcode會自動配置 配置使OC能調用swift類 然後在需要調用swift類的地方加上頭文件格式

原创 識別旋轉手勢

import UIKit class ViewController: UIViewController { @IBOutlet weak var rotationView: UIView! @IBOutlet

原创 識別搖晃手勢

import UIKit class ViewController: UIViewController { @IBOutlet weak var shakingLb: UILabel! ove

原创 UIDynamics創建運動視圖

import UIKit class ViewController: UIViewController { var animator : UIDynamicAnimator? @IBOutlet wea

原创 Core Animation移動圖片

import UIKit class ViewController: UIViewController { @IBOutlet weak var ball: UIView! override func

原创 在視圖上實現彈起效果

import UIKit import QuartzCore class ViewController: UIViewController { @IBOutlet weak var popingView: UIView

原创 UIAppearance定製UI元素

import UIKit class ViewController: UIViewController { @IBOutlet weak var button: UIButton! @IBOutlet

原创 iOS 真機模擬器framework合併

lipo -create 真機路徑 模擬器路徑 -output 真機路徑 lipo -info 查看

原创 識別捏合手勢

import UIKit class ViewController: UIViewController { @IBOutlet weak var scalingView: UIView! //當前視圖縮

原创 Mac OS 開發 NSTextViewNSTextField回車shift回車區分(oc)(swift)

判斷NSTextView和NSTextField的回車跟shift回車事件 OC代碼 #pragma mark - NSTextFieldDelegate - (BOOL)control:(NSControl *)control

原创 UIView進行3D旋轉

import UIKit import QuartzCore class ViewController: UIViewController { @IBOutlet weak var rotationView: UIVi

原创 Mac OS 貝塞爾曲線畫氣泡

- (void)drawRect:(NSRect)dirtyRect { [super drawRect:dirtyRect]; NSBezierPath* bezier = [NSBezierPath be

原创 使用多個AVAudioPlayer

import UIKit import AVFoundation /** 雖然可以使用多個AVAudioPlayer,但通常情況下爲了保證性能應該儘可能重用AVAudioPlayer 1.用一個數組保存了所有的AVAudioPl

原创 CoreImage濾鏡動態模糊

import UIKit class ViewController: UIViewController { @IBOutlet weak var imageView1: UIImageView! @IB