if (isGameOne == TRUE and isGameTwo == FALSE){
x.view.frame = xGraph->theGraph.frame;
y.view.frame = yGraph->theGraph.frame;
} else {
/*remove above frame here*/
}
Above is my script i am working with. When isGameOne
is true, i want it to attach x.view.frame
to xGraph->theGraph.frame;
And same for 'y', but this works fine.
What i am having an issue with is understanding how i would remove x.view.frame开发者_如何转开发
the frame if isGameOne
is not true (false).
I am sure its probably something really easy to do, but i am still getting my hand dirty with objective-c. Sorry for my ignorance
Cheers
=========[ How to do this ]========
I actually have a button that quits game one, so inside the gameOne
method i have
if (isGameOne == TRUE and isGameTwo == FALSE){ x.view.frame = xGraph->theGraph.frame; y.view.frame = yGraph->theGraph.frame; }
inside my quit
button method i added:
isGameTwo = TRUE; isGameOne = FALSE; if (isGameOne == FALSE and isGameTwo == TRUE) { /* code to remove *DoodlePad from *Grap */ [xDoodlePad.view setHidden:YES]; [yDoodlePad.view setHidden:YES]; }
It depends on what you are doing with those frames. If you want them to be moved to another location on the screen, you could predefine that frame elsewhere and assign it, or you could use CGRectMake to create a specific frame right there.
If you are wanting to hide/show the views based on this condition, you should already have the appropriate frames set before the conditional and just call setHidden on the views with the appropriate argument.
Note that CGRects are structs, so there is assignment of the value itself taking place. You are not maintaining a reference to the other frame.
精彩评论