07b-Flip View Core Anim

  • warning: Declaration of views_handler_argument::init(&$view, &$options) should be compatible with views_handler::init(&$view, $options) in /home/xnvgu7/public_html/sites/all/modules/views/handlers/views_handler_argument.inc on line 745.
  • warning: Declaration of views_handler_filter::options_validate(&$form, &$form_state) should be compatible with views_handler::options_validate($form, &$form_state) in /home/xnvgu7/public_html/sites/all/modules/views/handlers/views_handler_filter.inc on line 585.
  • warning: Declaration of views_handler_filter::options_submit(&$form, &$form_state) should be compatible with views_handler::options_submit($form, &$form_state) in /home/xnvgu7/public_html/sites/all/modules/views/handlers/views_handler_filter.inc on line 585.
  • warning: Declaration of views_handler_filter_boolean_operator::value_validate(&$form, &$form_state) should be compatible with views_handler_filter::value_validate($form, &$form_state) in /home/xnvgu7/public_html/sites/all/modules/views/handlers/views_handler_filter_boolean_operator.inc on line 149.
  • warning: Declaration of views_plugin_style_default::options(&$options) should be compatible with views_object::options() in /home/xnvgu7/public_html/sites/all/modules/views/plugins/views_plugin_style_default.inc on line 25.
  • warning: Declaration of views_plugin_row::options_validate($form, &$form_state) should be compatible with views_plugin::options_validate(&$form, &$form_state) in /home/xnvgu7/public_html/sites/all/modules/views/plugins/views_plugin_row.inc on line 135.
  • warning: Declaration of views_plugin_row::options_submit($form, &$form_state) should be compatible with views_plugin::options_submit(&$form, &$form_state) in /home/xnvgu7/public_html/sites/all/modules/views/plugins/views_plugin_row.inc on line 135.

iPhone SDK開發範例大全第二章之十Flip View Core Animation(10/14):2009年09月01a日星期二

iPhone SDK開發範例大全即iPhone Developer's CookBook的中文譯本,程式可由erica網站下載。第二章講View(視圖),程式共有十四個:

本文講第九個程式07b-Flip View Core Anim,CookBook 中文譯本2-10、91頁:

(A)這個程式會先在iPhone螢幕上顯示This is the Front View及箭頭,click任何地方後,畫面會向右滑( Core Animation Transition , CATransition)至下個畫面---This is the Back View及箭頭,每次click,交替出現,見下圖。

 

(B)新產生FlipView class的touchesEnded:產生Core Animation Transition效果的方式是先產生一個CATransition class的object,Core Animation Transition是用Layer而非View,特別注意19行:

11行,CATransition *animation = [CATransition animation];

15行,[animation setType: kCATransitionPush];

16行,[animation setSubtype: kCATransitionFromLeft];

19行

[self superview] 傳回UIView

[[self superview] layer] 傳回 CALayer,addAnimation將@"transitionViewAnimation"這animation加入Layer(圖層)。transitionViewAnimation是自己取的。