05a-HUD

  • 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開發範例大全第四章之七05a-HUD(7/15):2009年11月12d日星期四

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

本文講第七個程式05a-HUD,CookBook 中文譯本4-7、150~151頁(訣竅4-5)。

(A)本程式在Naviagtion Bar上有"DO It" button,click這個button即出現一個UIProgressHUD(第三行)一段時間,HUD有"Downloading File. Please wait"字眼。注意:UIProgressHUD並非cocoa touch的功能,是erica自己寫的,在3~5行。

(B)達成pop up HUD 的方法很簡單,下44行action:@selector(presentSheet)讓使用者click DoIt時跳至第18行的presentSheet。詳述presentSheet如下:

20行:id HUD = [[UIProgressHUD alloc ] initWithWindow:[self.view superview]]; 產生HUD物件。並顯示在self.view(HelloController)的superview (原UINavigationController) 上(55行)。

21行~24行:

  1. 21行~setText: (NSString *) text讓text出現在HUD上。本例是@"Downloading File. Please wait"。
  2. 22行~show: (BOOL) yesOrNo決定是否顯示。本例是YES。
  3. 24行~performSelector:設定在5秒後perform killHUD:HUD。

在3~5行有 to UIProgressHUD class inherit自NSObject。說明如下。HeadsUPUI

第4行為show。

第5行為initWithWindow。

奇妙的是根本不用synthesize,直接用。