The following code shows how to use an unofficial iPhone SDK to display a progress bar when reading data. The following code references assumerss. Define the header file: # import uikit/uiprogresshud. h @ interface eyecandy: uiapplication {uiprogresshud * progress;}-(V
The following code shows how to use an unofficial iPhone SDK to display a progress bar when reading data.
The following code references assumerss.
Define the header file:
- # Import "uikit/uiprogresshud. H"
-
- @ Interface eyecandy: uiapplication {
- Uiprogresshud * progress;
- }
-
- -(Void) showprogresshud :( nsstring *) label withwindow :( uiwindow *) W withview :( uiview *) V withrect :( struct cgrect) rect;
- -(Void) hideprogresshud;
-
- @ End
The quotation marks must be changed to <>.
- Import "eyecandy. H"
-
- @ Implementation eyecandy
- -(Void) showprogresshud :( nsstring *) label withwindow :( uiwindow *) W withview :( uiview *) V withrect :( struct cgrect) rect
- {
- Progress = [[uiprogresshud alloc] initwithwindow: W];
- [Progress settext: Label];
- [Progress drawrect: rect];
- [Progress show: Yes];
-
- [V addsubview: progress];
- }
-
- -(Void) hideprogresshud
- {
- [Progress show: No];
- [Progress removefromsuperview];
- }
-
- @ End
Run the following code:
- // Setup eye candy view
- _ Eyecandy = [[eyecandy alloc] init] retain];
-
- // Call loading display
- [_ Eyecandy showprogresshud: @ "loading... "Withwindow: Window withview: mainview withrect: cgrectmake (0.0f, 1000000f, 3200000f, 500000f)];
-
- // When finished for hiding the & quot; loading text & quot;
- [_ Eyecandy hideprogresshud];