Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

iOS and MacOS / [TUTORIAL] Custom HUD

Author
Message
xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 3rd Oct 2012 16:38 Edited at: 3rd Oct 2012 17:14
This time i will show you how to have a custom HUD that show in the center of the screen while you are loading some files or receiving data from internet.
This HUD most of the times is required by Apple, cause they reject apps that don't alert the final user that the device seems "freezed" while loading.
So i suggest you use it if your app must wait some seconds doing something.

1. Link Library
Go to the project build window and link libraries.
Press add libraries and chose:
- UIKit.framework
- QuartzCore.framework

If when you add the library it goes out of your Framework group (folder) drag it into the one you want and after drag again it from the folder to the link libraries window (this is a trick to do faster).


2. Importing Libraries
Those libraries are usually common when you start a project, i suggest to import in your UntitledViewController.h:
#import <QuartzCore/QuartzCore.h>
#import <UIKit/UIKit.h>

3. Adding the functions
First we add the declaration in the UntitledViewController.h


4. Adding the real code
Add this to UntitledViewController.m


In this code you can find some italian words:
- titolo = title
- sottotitolo/subtitolo = subtitle
So change it if you prefer another language

5. Show the HUD
Now if you remember how we shared the UntitledViewController in AppGameKit in the c++ file, you know we can do, if you don't remember it go to the end of the post :


6. Delete the HUD when you are done


Bonus function to delete views
You need this function to have HUD work.
UntitledViewController.h


UntitledViewController.m


Just to remember it....
Trick to have the UntitledViewController in the C++ AGK
Add this line to your declaration in the AppGameKit template.c;
UntitledViewController *VC = [UntitledViewController alloc];

Hope you enjoy this and ask question if you need!


Long life to Steve!

Login to post a reply

Server time is: 2024-04-20 08:28:27
Your offset time is: 2024-04-20 08:28:27