fb_license

技術標籤

@selector (1) 初使化區塊 (1) 物件 (1) 物件導向 (2) 型別 (4) 封裝 (1) 流程控制 (1) 陣列 (3) 推論型別 (2) 實機測試 (1) 蓋索林(gasolin) (1) 模組 (1) 憑證 (1) 轉型 (1) 羅康鴻 (121) 類別 (1) 變數 (5) Accelerometer (1) ActiveRecord (1) Activity (1) AFNetworking (1) alloc (1) Android (3) Animation (1) App (1) App ID (1) APP上傳 (1) ASP.NET (1) AVAudioPlayer (1) block (1) C# (2) class (1) CLLocationManager (1) CLLocationManagerDelegate (1) CMMotionManager (4) Controller (1) delegate (1) DELETE語法 (1) Device Motion資料 (1) Dialog (1) DropDownList (1) dynamic language (2) Facebook SDK (9) FBRequest (5) FBRequestConnection (2) FMDB (1) Gesture Recognizers (6) GROUP BY (2) Gyro (1) HAVING (1) IBAction (1) IBOutlet (1) id (3) inheritance (1) init (1) Insert (1) instance variable (1) Interface Builder (1) iOS (70) iOS idea (7) iOS Introduction (1) Layout (1) Magnetometer (1) Menu (2) Method (2) MKMapView (1) MKPointAnnotation (1) MS SQL (5) Nil (1) NSArray (1) NSDictionary (1) NSError (1) NSFileManager & .plist (1) NSMutableArray (1) NSMutableDictionary (1) NSNotificationCenter (1) NULL (1) object (2) Objective-C (16) Objective-C idea (1) ORDER BY (1) Parameter (1) property (1) protocol (2) Provisioning (1) Proximate Sensor (1) Q and A (2) R類別 (1) Rails (9) RESTful SOA (9) Ruby (8) Scene (1) SEELECT (1) Segue (2) SEL (1) SELECT語法 (1) Shake (1) Simulator (1) SOA (8) SQL (6) SQL Server (5) SQL函數 (1) SQL彙總函數 SQL (1) SQLite (1) Storyboard (1) Style (1) Swift (1) Table (1) target & action (1) Theme (1) Toast (1) TRUNCATE TABLE語法 (1) UIActionSheet (1) UIActionSheetDelegate (1) UIActivityIndicatorView (1) UIAlertView (1) UIBarButtonItem (1) UIButton (1) UICollectionView (1) UICollectionViewDataSource (1) UIControl (9) UIDatePicker (1) UIImage (1) UIImagePickerController (2) UIImagePickerControllerDelegate (2) UIImageView (1) UILabel (1) UILongPressGestureRecognizer (1) UINavigationController (2) UIPanGestureRecognizer (1) UIPinchGestureRecognizer (1) UIProgressView (1) UIResponder (1) UIRotationGestureRecognizer (1) UISegmentedControl (1) UISlider (1) UIStepper (1) UISwipeGestureRecognizer (1) UISwitch (1) UITabBarController (1) UITableView (1) UITableViewDataSource (1) UITapGestureRecognizer (1) UITextField (1) UITextFieldDelegate (1) UITextView (2) UITextViewDelegate (1) UIToolBar (1) UIView (8) UIWebView (1) UPDATE語法 (1) var (2) VB.NET (7) View (4) WHERE子句 (1) XML (1)

2013/06/04

[iOS] "觸碰+動感" 到 "繪圖+動畫" 再到 "使用者基本互動" UIResponder -> UIView -> UIControl


idea...


我是UIResponder,我負責觸碰與動感



我是UIView,我繼承UIResponder,
所以我除了擁有觸碰與動感的能力外,我還負責畫面的繪製與動畫



我是UIControl,我繼承UIView,除了擁有觸碰、動感、與畫面繪製與動畫的能力外,我還針對使用者提供使用者基本互動能力




UIResponder

iOS的觸碰功能由我而生,我處理了使用觸碰相關的事件,當然我也針對iOS搖動的動作感應進行事件處理,因此我有以下能力:

回覆觸碰事件

回覆動感事件

除此之後還作一些基本的回覆能力:

管理輸入視圖

管理回應鏈"Responder Chain"

回覆遠端控制事件

取得復原管理器"undoManager"

驗證可執行的動 作





UIView

為了要讓iOS的螢幕上有視覺化的視圖,因此我UIView提供繪圖與動畫的能力,讓iOS螢幕上長出一個一個畫面外還可以加上動畫的效果,因此我有以下能力:

初使化視圖物件

設定事件行為

視定視圖的顯示效果

設定邊界與框架

管理視圖的階層

繪製與更新視圖

管理手勢

為視圖加上動畫

點擊測試



UIView的其他能力請參考:http://developer.apple.com/library/ios/#documentation/uikit/reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/cl/UIView



繼承UIView的視圖有:
  • UILabel
  • UIActionSheet
  • UIProgressView
  • UIPickerView
  • UIImageView
  • UIWebView
  • UIActivityIndicatorView
  • UITextView
  • UIToolbar
  • UIAlertView






UIControl


為了讓使用者更輕鬆使用iOS,我UIControl定義了一些使用者常用來操作iOS的,好在使用者發生對應的操作事件時進行處理。


設定控制項的屬性

追蹤觸碰與重繪控制項



準備和傳作操作訊息



透過Target & Action設計模式,連結以下使用者的操作事件,如"UIControlEventTouchDown"表示使用者"按下"的動作:

enum {
   UIControlEventTouchDown           = 1 <<  0,
   UIControlEventTouchDownRepeat     = 1 <<  1,
   UIControlEventTouchDragInside     = 1 <<  2,
   UIControlEventTouchDragOutside    = 1 <<  3,
   UIControlEventTouchDragEnter      = 1 <<  4,
   UIControlEventTouchDragExit       = 1 <<  5,
   UIControlEventTouchUpInside       = 1 <<  6,
   UIControlEventTouchUpOutside      = 1 <<  7,
   UIControlEventTouchCancel         = 1 <<  8,
   
   UIControlEventValueChanged        = 1 << 12,
   
   UIControlEventEditingDidBegin     = 1 << 16,
   UIControlEventEditingChanged      = 1 << 17,
   UIControlEventEditingDidEnd       = 1 << 18,
   UIControlEventEditingDidEndOnExit = 1 << 19,
   
   UIControlEventAllTouchEvents      = 0x00000FFF,
   UIControlEventAllEditingEvents    = 0x000F0000,
   UIControlEventApplicationReserved = 0x0F000000,
   UIControlEventSystemReserved      = 0xF0000000,
   UIControlEventAllEvents           = 0xFFFFFFFF
};

當然,只要是繼承自UIControl的控制項,都可在Interface Builder按右鍵,以IBAction的方式連結事件,下圖中"Sent Events",就是我UIControl定義給使用者操作的事件。










































繼承UIControl的控制項有:
  • UIButton
  • UISwitch
  • UISilder
  • UIStepper
  • UITextField
  • UIPageControl
  • UIDatePicker
  • UISegmentedControl