Okay, so here's my problem. I have a game that im currently developing and Im adding a basic life system. The only problem Im having, is that there is a label to display the life, and that works fine. But when I go to a new view(happens frequently in my game), I need to connect the label in my new view to the same IBOutlet as my initial label, so that it will remain updated with the life value. Can someone please show me how to do this, I need to link the label in the 2nd, 3rd, 4th views etc, to the same IBOutlet as the label in the 1st view. I dont want to make about 50 IBOutlets for a new label on each view.
Also, when I preform a baisc check for the life Im having some problems. I have it setup so that if the life < 0, it does the following:
[self removeFromSuperview];
[self addSubview:GameOver];
This works fine when I want to transition between views with buttons(I replace the first "self" with the current view name), but when I do it like this by adding the "self removeFromSuperview];" I get problems. Instead of going to the GameOver view, it just goes to a plain white view(which I dont have). I can get it to work with buttons, but I keep having problems when I try to make it automatically go to the GameOver view when the life <0.
I hope someone can help me with this, and please dont be harsh. I just started programming for iPhone, so I would REALLY appreciate the help. Thanks for reading my long post!
EDIT: I got the second problem to work with the views not coming up correctly. I just removed the first line of code"[self removeFromSuperview];" and it worked perfectly. I know, that this is eating up processes/cpu cycles because the view was not released, but instead a new view was loaded on top of it. If anyone knows a better way that works, Im happy to take suggestions!
Also, when I preform a baisc check for the life Im having some problems. I have it setup so that if the life < 0, it does the following:
[self removeFromSuperview];
[self addSubview:GameOver];
This works fine when I want to transition between views with buttons(I replace the first "self" with the current view name), but when I do it like this by adding the "self removeFromSuperview];" I get problems. Instead of going to the GameOver view, it just goes to a plain white view(which I dont have). I can get it to work with buttons, but I keep having problems when I try to make it automatically go to the GameOver view when the life <0.
I hope someone can help me with this, and please dont be harsh. I just started programming for iPhone, so I would REALLY appreciate the help. Thanks for reading my long post!
EDIT: I got the second problem to work with the views not coming up correctly. I just removed the first line of code"[self removeFromSuperview];" and it worked perfectly. I know, that this is eating up processes/cpu cycles because the view was not released, but instead a new view was loaded on top of it. If anyone knows a better way that works, Im happy to take suggestions!