06b-ProgressInd2

  • 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開發範例大全第四章之九06b-ProgressInd2(9/15):2009年11月12f日星期四

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

本文講第9個程式06b-ProgressInd2,CookBook 中文譯本4-8、152~154頁(訣竅4-8),與iPhone SDK開發範例大全第四章之八06a-ProgressInd1(8/15)類似,但改變setActivityIndicatorViewStyle為UIActivityIndicatorViewStyleWhiteLarge。

(A)本程式在Naviagtion Bar上有"DO It" button,click這個button即出現一個UIActivityIndicatorView indicator ,再click"DO It",UIActivityIndicatorView indicator消失。

 

(B)達成顯示UIActivityIndicatorView indicator 的方法很簡單,下36行action:@selector(performAction)讓使用者click DoIt時跳至第12行的performAction。UIActivityIndicatorView inherit自UIView:UIResponder:NSObject 。詳述如下:

14行:UIActivityIndicatorView *activityIndicator = ( UIActivityIndicatorView *) [self.view viewWithTag: INDICATOR_VIEW]; assign 在loadView 39~45行產生的UIActivityIndicatorView 物件。

15行~16行:

  1. 15行~如果已經progressShowing則停止activityIndicator,否則開始animated activityIndicator。
  2. 16行~negate progressShowing。

loadView 39~45行產生的UIActivityIndicatorView 物件的說明:

39行:設progressShowing為NO。

40行:用UIViewinitWithFrame: message 產生一個32x32的activityIndicator。

41行:用UIViewsetCenter:設定中心。

42行:setActivityIndicatorViewStyle:設型式 為UIActivityIndicatorViewStyleWhiteLarge。

44行:用UIView的tag設tag。

45行:add subview。