I am writing an iOS application for iPhone in Xcode, and I created several classes, as well as their methods in my .h and .m files (which are two classes, so basically I have two pairs of .h and .m files)
Now I want to start writing my main loop , which will be executed whenever the user clicks the play button, but where exactly am I doing this?
Am I doing this in ViewController.m? for example inside this method:
- (IBAction)playPressed:(UIButton *)sender { // main loop executed in here ? // or simply message to the main loop to start executing is *sent* from here ? }
I read about a similar question here, and someone suggested AppDelegate. Now will it be AppDelegate.m or AppDelegate.h? And if so, I'm just starting to write code or include everything inside:
int main(int argc, char **argv) { .... }
in the Appdelegate file?
I tried to just start an instance of classes and declare common methods (not belonging to any particular class that is ..) in the game.m file that I created and I get the initialization element is not a compile time constant as soon as I try create something.
Any help? Based on C ++, this would really help me figure out once and for all in which file my main loop should write, and should I wrap it in some kind of int main () function ..
thanks!
PS:
Just in case, it matters, my ViewController will consist only of a play button that starts the execution of my main loop whenever it is pressed, and a stop button that stops the main loop
I created my respective methods in ViewController.m:
- (IBAction)playPressed:(UIButton *)sender {
which are still empty :)
user1073400
source share