<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>cocos2d for iPhone &#187; Forum: cocos2d support (graphics engine) - Recent Posts</title>
		<link>http://www.cocos2d-iphone.org/forum/forum/2</link>
		<description>A fast, easy to use, free, and community supported 2D game engine</description>
		<language>en-US</language>
		<pubDate>Thu, 09 Feb 2012 21:05:33 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.cocos2d-iphone.org/forum/search.php</link>
		</textInput>
		<atom:link href="http://www.cocos2d-iphone.org/forum/rss/forum/2" rel="self" type="application/rss+xml" />

		<item>
			<title>ayt on "workaround for %33 texture memory bug"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29121#post-143521</link>
			<pubDate>Thu, 09 Feb 2012 20:58:21 +0000</pubDate>
			<dc:creator>ayt</dc:creator>
			<guid isPermaLink="false">143521@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Can't I just comment out the line that allocates the mipmap's space?<br />
Where is it?
</p></description>
		</item>
		<item>
			<title>Birkemose on "CCSprite Problem with Blending when using Custom Drawing"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29116#post-143520</link>
			<pubDate>Thu, 09 Feb 2012 20:25:40 +0000</pubDate>
			<dc:creator>Birkemose</dc:creator>
			<guid isPermaLink="false">143520@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hard to tell from your code.<br />
For custom draw, the most important part ( apart from getting the result you want ), is to return OpenGL to the state it was in before you started messing around. Even if your code actually works as intended, failing to do so, can result in cocos2d suddenly rendering wrong.
</p></description>
		</item>
		<item>
			<title>Birkemose on "Cocos 2D slow vs native OpenGL"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29105#post-143519</link>
			<pubDate>Thu, 09 Feb 2012 20:19:15 +0000</pubDate>
			<dc:creator>Birkemose</dc:creator>
			<guid isPermaLink="false">143519@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>It could be from leaks, but if it is - as you say - immediate, it is probably from loading resources.<br />
2.gen devices will pop level 1 warnings from  textures quite easily, as they have fixed texture memory.
</p></description>
		</item>
		<item>
			<title>Hemingway72 on "Cocos 2D slow vs native OpenGL"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29105#post-143518</link>
			<pubDate>Thu, 09 Feb 2012 20:13:16 +0000</pubDate>
			<dc:creator>Hemingway72</dc:creator>
			<guid isPermaLink="false">143518@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Thanks guys,<br />
Tried a release build and noticed an immediate improvement, even without any optimisations - I'll start on those next;)<br />
I did notice an immediate memory warning though, could this be from anything other than my game assets and objects using too much memory?</p>
<p>Cheers
</p></description>
		</item>
		<item>
			<title>Birkemose on "workaround for %33 texture memory bug"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29121#post-143516</link>
			<pubDate>Thu, 09 Feb 2012 20:09:07 +0000</pubDate>
			<dc:creator>Birkemose</dc:creator>
			<guid isPermaLink="false">143516@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Isn't a 2048 *1024 a humongous waste of memory anyways?
</p></description>
		</item>
		<item>
			<title>Ernesto Corvi on "workaround for %33 texture memory bug"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29121#post-143515</link>
			<pubDate>Thu, 09 Feb 2012 20:03:52 +0000</pubDate>
			<dc:creator>Ernesto Corvi</dc:creator>
			<guid isPermaLink="false">143515@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>EDIT: I just followed the link to Apple's forum and it's indeed a bug. Disregard my last suggestion.
</p></description>
		</item>
		<item>
			<title>leocck on "workaround for %33 texture memory bug"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29121#post-143514</link>
			<pubDate>Thu, 09 Feb 2012 20:01:00 +0000</pubDate>
			<dc:creator>leocck</dc:creator>
			<guid isPermaLink="false">143514@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Thanks Riq!
</p></description>
		</item>
		<item>
			<title>MandarX on "workaround for %33 texture memory bug"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29121#post-143513</link>
			<pubDate>Thu, 09 Feb 2012 20:00:38 +0000</pubDate>
			<dc:creator>MandarX</dc:creator>
			<guid isPermaLink="false">143513@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>thanks Riq
</p></description>
		</item>
		<item>
			<title>Karl on "[?]Class A imports B, B needs to import A too..."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29119#post-143512</link>
			<pubDate>Thu, 09 Feb 2012 19:55:28 +0000</pubDate>
			<dc:creator>Karl</dc:creator>
			<guid isPermaLink="false">143512@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>When you find that classes require two-way communication, it can commonly be a sign of bad OO design, as birkemose said. However, there are cases where it's completely warranted. In such a case, you have three choices:</p>
<p>1. Make both aware of each other using the @class forward declaration, as mentioned earlier (this is usually the wrong approach).<br />
2. Use the delegate pattern, which is a commonly used pattern in UIKit (UIApplicationDelegate being used in EVERY iOS app).<br />
3. Register callbacks for the object that doesn't need to know about the other, except for notifications. This can be done with target/selector, blocks, or even monitoring NSNotifications or KVO (which is useful when multiple classes may be interested in events a class could generate).
</p></description>
		</item>
		<item>
			<title>Duckwit on "[?]Class A imports B, B needs to import A too..."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29119#post-143502</link>
			<pubDate>Thu, 09 Feb 2012 19:40:13 +0000</pubDate>
			<dc:creator>Duckwit</dc:creator>
			<guid isPermaLink="false">143502@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/20192'>Birkemose</a> - Very wise advice, and I would love to take the time to implement it - but this here is just for a quick level-editor I made for my personal use only, so the code doesn't really need to work 'well' it just needs to work. (Which it does, and very smoothly + extremely fast as well).
</p></description>
		</item>
		<item>
			<title>riq on "workaround for %33 texture memory bug"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29121#post-143498</link>
			<pubDate>Thu, 09 Feb 2012 19:38:45 +0000</pubDate>
			<dc:creator>riq</dc:creator>
			<guid isPermaLink="false">143498@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/12069'>rickms</a>: :-)
</p></description>
		</item>
		<item>
			<title>riq on "Is it possible to mix RGBA8888 and RGBA4444 in the same scene/layer?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29122#post-143495</link>
			<pubDate>Thu, 09 Feb 2012 19:37:53 +0000</pubDate>
			<dc:creator>riq</dc:creator>
			<guid isPermaLink="false">143495@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>You can mix 4444, 8888, 5551, 565, LA88, L8, etc... textures.</p>
<p>The PVR images are not affected by the  <code>[CCTexture2D setDefaultAlphaPixelFormat:]</code> method.
</p></description>
		</item>
		<item>
			<title>rickms on "workaround for %33 texture memory bug"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29121#post-143491</link>
			<pubDate>Thu, 09 Feb 2012 19:34:49 +0000</pubDate>
			<dc:creator>rickms</dc:creator>
			<guid isPermaLink="false">143491@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Thanks for the tip riq! I just enabled CC_TEXTURE_NPOT_SUPPORT and modified my TP script to max size @2047, rebuilt and my average memory usage went from ~63M to ~49M.
</p></description>
		</item>
		<item>
			<title>riq on "workaround for %33 texture memory bug"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29121#post-143490</link>
			<pubDate>Thu, 09 Feb 2012 19:34:19 +0000</pubDate>
			<dc:creator>riq</dc:creator>
			<guid isPermaLink="false">143490@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/9358'>MandarX</a>:<br />
v1.0 and prior versions (0.99.x, 0.8.x, etc) should edit the <code>ccConfig.h</code> file.
</p></description>
		</item>
		<item>
			<title>neigaard on "Is it possible to mix RGBA8888 and RGBA4444 in the same scene/layer?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29122#post-143489</link>
			<pubDate>Thu, 09 Feb 2012 19:28:56 +0000</pubDate>
			<dc:creator>neigaard</dc:creator>
			<guid isPermaLink="false">143489@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi</p>
<p>I would like to use RGBA4444 in some of my PVR textures and RGBA8888 in others of my PVR textures. No as I understand it the PVR includes information about wether it is RGBA8888 or RGBA4444, but will cocos2d work well with this also reducing memory usage on the RGBA4444 textures and still render my RGBA8888 textures in lovely 32 bit?</p>
<p>Thank you<br />
Søren
</p></description>
		</item>
		<item>
			<title>MandarX on "workaround for %33 texture memory bug"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29121#post-143488</link>
			<pubDate>Thu, 09 Feb 2012 19:27:52 +0000</pubDate>
			<dc:creator>MandarX</dc:creator>
			<guid isPermaLink="false">143488@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Thanks!</p>
<p>What about the previous releases?</p>
<p>I know I should upgrade to v1 or v2 but I'm working on 2 projects that use v0.99.5</p>
<p>I will switch to the latest version when I finish!!</p>
<p>MandarX
</p></description>
		</item>
		<item>
			<title>riq on "workaround for %33 texture memory bug"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29121#post-143486</link>
			<pubDate>Thu, 09 Feb 2012 19:10:33 +0000</pubDate>
			<dc:creator>riq</dc:creator>
			<guid isPermaLink="false">143486@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>So,</p>
<p>If you didn't know, when you create texture, iOS will allocate 33% more memory, presumably to have enough room in case mipmaps are needed.<br />
( <a href="http://www.cocos2d-iphone.org/forum/topic/23887#post-129097" rel="nofollow">http://www.cocos2d-iphone.org/forum/topic/23887#post-129097</a> )</p>
<p>But it is worth noting that this bug is only present on POT (Power Of Two) textures ( Mipmapping is only supported on POT textures ).<br />
So, in order to reduce memory, what you have to do is two create NPOT textures.</p>
<p>eg:<br />
If you are using a 2048x2048 textures, convert it into a 2048x2047 textures (and you will save 33% memory).<br />
In case you can't make it smaller, then make it bigger. eg:<br />
If you have a 2048x1024 texture, create a 2048x1025 texture.</p>
<p>If you are using cocos2d v1.0, then you have to edit <code>ccConfig.h</code> with:<br />
<pre><code>#<a href='http://www.cocos2d-iphone.org/forum/tags/define'>define</a> CC_TEXTURE_NPOT_SUPPORT 1</code></pre>
<p>If you are using v1.1 or v2.0, then you are OK, since they already support NPOT textures by default.</p>
<p>Ways to know if you are using POT / NPOT textures:<br />
<strong>A)</strong>  Parse your PNG, GIF, BMP, JPEG files with <code>file</code>:<br />
<pre><code>$ find . -name &#34;*.png&#34; -print0 &#124; xargs -0 file</code></pre>
<p><strong>B)</strong> Run this line of code and see your debug console:<br />
<pre><code>[[CCTextureCache sharedTextureCache] dumpCachedTextureInfo];</code></pre>
<p>Further info:<br />
<a href="https://devforums.apple.com/thread/113889?start=0&#038;tstart=0" rel="nofollow">https://devforums.apple.com/thread/113889?start=0&#038;tstart=0</a></p>
<p>Important: NPOT textures can't have mipmaps, and also they only accept GL_CLAMP_TO_EDGE in GL_TEXTURE_WRAP_{S,T}</p>
<p>Important 2: PVRTC (2bpp and 4bpp) textures can't be converted to NPOT
</p></description>
		</item>
		<item>
			<title>Thomvis on "Moving a sprite across multiple coordinates using CCSequence"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29115#post-143483</link>
			<pubDate>Thu, 09 Feb 2012 18:37:22 +0000</pubDate>
			<dc:creator>Thomvis</dc:creator>
			<guid isPermaLink="false">143483@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Oh, yeah, that makes more sense. The version of cocos2d I am using in my current project and used to come up with my solution didn't have that yet. That said, the actionsWithArray: method does the exact same thing as I wrote (compositing a action tree), it just hides it from the user. Thanks!
</p></description>
		</item>
		<item>
			<title>rickms on "Moving a sprite across multiple coordinates using CCSequence"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29115#post-143481</link>
			<pubDate>Thu, 09 Feb 2012 18:31:41 +0000</pubDate>
			<dc:creator>rickms</dc:creator>
			<guid isPermaLink="false">143481@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Here is an alternative solution</p>
<pre><code>int pat_x1, pat_y1;
NSMutableArray *moveActions = [NSMutableArray arrayWithCapacity:[patrolPathX1 count]];

for (int x = 0; x&#60;[patrolPathX1 count]; x++){

    pat_x1=[[patrolPathX1 objectAtIndex:x]intValue];
    pat_y1=[[patrolPathY1 objectAtIndex:x]intValue];

    [moveActions addObject:[CCMoveTo actionWithDuration:1.5 position:[self positionForTileCoord:CGPointMake((float) pat_x1, (float) pat_y1)]]];

}

[enemy2 runAction:[CCSequence actionsWithArray:moveActions]];</code></pre>
<p>Also, an alternative method of storing the coordinates would be 1 array of NSValues, which can be used to store a CGPoint.
</p></description>
		</item>
		<item>
			<title>noodlz on "Moving a sprite across multiple coordinates using CCSequence"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29115#post-143478</link>
			<pubDate>Thu, 09 Feb 2012 18:02:00 +0000</pubDate>
			<dc:creator>noodlz</dc:creator>
			<guid isPermaLink="false">143478@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Thanks very much Thomvis! Works perfectly :)
</p></description>
		</item>
		<item>
			<title>MandarX on "CCSpriteBatchNode and CCSprite"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29113#post-143477</link>
			<pubDate>Thu, 09 Feb 2012 17:58:23 +0000</pubDate>
			<dc:creator>MandarX</dc:creator>
			<guid isPermaLink="false">143477@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>The CCSpriteBatchNode can be used whenever you display two or more CCSprites.<br />
You have to group together your CCSprites in a single texture and tell Cocos2D that you have a group of sprites that should be rendered using the same texture.<br />
The graphics hardware will perform the preparation and cleanup steps only once for that group of sprites.</p>
<p>If you use a lot of CCSprites on different textures, there will be an inherent overhead caused by starting and ending the rendering of a every texture.</p>
<p>Take a look here:</p>
<p><a href="http://www.raywenderlich.com/2361/how-to-create-and-optimize-sprite-sheets-in-cocos2d-with-texture-packer-and-pixel-formats" rel="nofollow">http://www.raywenderlich.com/2361/how-to-create-and-optimize-sprite-sheets-in-cocos2d-with-texture-packer-and-pixel-formats</a></p>
<p>MandarX
</p></description>
		</item>
		<item>
			<title>Lam on "CCprogressTimer blues! Unable to use Sprite Sheets?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29021#post-143476</link>
			<pubDate>Thu, 09 Feb 2012 17:54:16 +0000</pubDate>
			<dc:creator>Lam</dc:creator>
			<guid isPermaLink="false">143476@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Ok I've pushed changes to progress timer into the develop branch on my github. It'll handle rotated sprite frame textures:</p>
<p><a href="https://github.com/LamPham/cocos2d-iphone/tree/develop" rel="nofollow">https://github.com/LamPham/cocos2d-iphone/tree/develop</a></p>
<p>I also kept the interface the same across 2.0 and 1.0 so the gles20 branch is also updated</p>
<p><a href="https://github.com/LamPham/cocos2d-iphone/tree/gles20" rel="nofollow">https://github.com/LamPham/cocos2d-iphone/tree/gles20</a></p>
<p>I've added new tests in the 'develop' branch so you can run ProgressActionsTest.m to check the new logic.</p>
<p>I currently can't compile the 'gles20' branch for ActionProgressTest so I'm stumbling around there and I'm not going to do a pull request until I sort that out.  I'm sure though the logic will fix #1303 so it should be safe to check out the code.
</p></description>
		</item>
		<item>
			<title>Birkemose on "[?]Class A imports B, B needs to import A too..."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29119#post-143475</link>
			<pubDate>Thu, 09 Feb 2012 17:49:02 +0000</pubDate>
			<dc:creator>Birkemose</dc:creator>
			<guid isPermaLink="false">143475@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>While forward declarations work, they are no good.<br />
It is a common problem that you "suddenly" needs to cross-include two classes. Imo it should always be fixed by rethinking your class lay-out, because it will in the end result in a stronger OO-hierachy.
</p></description>
		</item>
		<item>
			<title>Thomvis on "Moving a sprite across multiple coordinates using CCSequence"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29115#post-143474</link>
			<pubDate>Thu, 09 Feb 2012 17:45:31 +0000</pubDate>
			<dc:creator>Thomvis</dc:creator>
			<guid isPermaLink="false">143474@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>You call runAction for each individual coordinate. All CCMoveTo actions are executed simultaneously, instead of in sequence (to be more precise: all CCSequences containing one single CCMoveTo action are executed simultaneously). What you want is to have one big CCSequence with all the CCMoveTo actions in it. You can achieve that with the following code:</p>
<pre><code>int pat_x1, pat_y1;
CCAction *moveSequence = nil;

for (int x = 0; x&#60;[patrolPathX1 count]; x++){

pat_x1=[[patrolPathX1 objectAtIndex:x]intValue];
pat_y1=[[patrolPathY1 objectAtIndex:x]intValue];

CCMoveTo *patrolAction = [CCMoveTo actionWithDuration:1.5 position:[self positionForTileCoord:CGPointMake((float) pat_x1, (float) pat_y1)]];
if (moveSequence != nil) {
 moveSequence = [CCSequence actionOne: moveSequence two: patrolAction];
} else {
moveSequence = patrolAction; //the first action
}

}
[enemy2 runAction:moveSequence];</code></pre>
<p>At the end of the loop, you have a single action containing all the CCMoveTo's to run. Note that you actually create a kind of tree structure of actions, because each CCSequence has two child actions: a CCSequence child-action (containing a CCSequence and CCMoveTo) and a CCMoveTo. This is similar to what happens when you create a CCSequence with variable arguments.</p>
<p>Final note: I didn't test it, there might be stupid syntax errors or even worse. Also, I assumed you are using ACR, so I did no memory management.
</p></description>
		</item>
		<item>
			<title>Ap3x on "Need help to update tweejump sourcecode to 1.xx"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28885#post-143473</link>
			<pubDate>Thu, 09 Feb 2012 17:39:04 +0000</pubDate>
			<dc:creator>Ap3x</dc:creator>
			<guid isPermaLink="false">143473@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>that works! thank you :)
</p></description>
		</item>
		<item>
			<title>Thomvis on "Trimming final app size"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29117#post-143472</link>
			<pubDate>Thu, 09 Feb 2012 17:32:49 +0000</pubDate>
			<dc:creator>Thomvis</dc:creator>
			<guid isPermaLink="false">143472@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Search with Spotlight for your AppName.app (enable search through system files). The compiled version of your app is somewhere on your disk, the location depends on your Xcode settings. I can find the build products for my projects at: ~/Library/Developer/Xcode/DerivedData/ProjectName/Build/Products/...
</p></description>
		</item>
		<item>
			<title>Thomvis on "[SpaceManager] EXEC_BAD_ACCESS When Touching a sprite that has a collision"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29120#post-143471</link>
			<pubDate>Thu, 09 Feb 2012 17:28:35 +0000</pubDate>
			<dc:creator>Thomvis</dc:creator>
			<guid isPermaLink="false">143471@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I'd debug to that line and check the values in memory of STATIC_MASS and shape, shape-&#62;body and shape-&#62;body-&#62;m to see whether any of those are 0x0 (i.e. nil)
</p></description>
		</item>
		<item>
			<title>Duckwit on "[?]Class A imports B, B needs to import A too..."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29119#post-143470</link>
			<pubDate>Thu, 09 Feb 2012 17:20:08 +0000</pubDate>
			<dc:creator>Duckwit</dc:creator>
			<guid isPermaLink="false">143470@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Thanks @Martin and @<a href='http://www.cocos2d-iphone.org/forum/profile/31966'>frilla</a> - I implemented this just after @Martin posted and it is working beautifully. :)
</p></description>
		</item>
		<item>
			<title>frilla on "[?]Class A imports B, B needs to import A too..."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29119#post-143469</link>
			<pubDate>Thu, 09 Feb 2012 17:07:16 +0000</pubDate>
			<dc:creator>frilla</dc:creator>
			<guid isPermaLink="false">143469@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>As @Martin stated, you can use a forward declaration @class classNameHere on your header files so tell the compiler that you'll be refering to classes with this name in the header file but you won't be able to use them in the header file (for example call one of their methods).</p>
<p>In the implementation file, you'll have to import the header files in order to actually use the objects.</p>
<p>classA.h:<br />
<pre><code>@class classB;

classB *_pointerToClassB;</code></pre>
<p>classB.h:<br />
<pre><code>@class classA

classA *_pointerToClassA;</code></pre>
<p>classA.m:<br />
<pre><code>#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;classB.h&#34;

//you can now use classB</code></pre>
<p>classB.m:<br />
<pre><code>#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;classA.h
//you can now use classA</code></pre></description>
		</item>
		<item>
			<title>Martin on "[?]Class A imports B, B needs to import A too..."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29119#post-143468</link>
			<pubDate>Thu, 09 Feb 2012 16:58:17 +0000</pubDate>
			<dc:creator>Martin</dc:creator>
			<guid isPermaLink="false">143468@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I don't know whats the most proper solution, but you could use a protocol that one object conforms to, to define the methods the other object will use. Then both objects will import the file containing the protocol definition(s).<br />
And/Or you could import the header file of the other object only in the implementation file of your object. Afaik importing in the implementation does not generate cyclic dependencies.<br />
If your singleton stores a reference to the object you could use @class to "promise" the definition of the class will follow "later" (importing its header in the .m file). If I remember correctly that's how I usually do it.</p>
<p>p.s.: aaaand read this :)<br />
<a href="http://stackoverflow.com/questions/322597/class-vs-import" rel="nofollow">http://stackoverflow.com/questions/322597/class-vs-import</a>
</p></description>
		</item>

	</channel>
</rss>

