<?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; Tag: UIkit - Recent Topics</title>
		<link>http://www.cocos2d-iphone.org/forum/tags/uikit</link>
		<description>A fast, easy to use, free, and community supported 2D game engine</description>
		<language>en-US</language>
		<pubDate>Fri, 10 Feb 2012 03:54:24 +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/tags/uikit/topics" rel="self" type="application/rss+xml" />

		<item>
			<title>jsharp on "Put the CCLayer onto UIView"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28873#post-142263</link>
			<pubDate>Thu, 02 Feb 2012 07:58:50 +0000</pubDate>
			<dc:creator>jsharp</dc:creator>
			<guid isPermaLink="false">142263@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi, I'm use CCUIViewWrpper class for putting UIViews onto CCLayer. It's very helpful for me.<br />
But I need to make UIView under CCLayer.</p>
<p>I have a plan to make a painter app which is on the video player.<br />
I already made painter app using CCRenderTexture and I successfully player video using MPMoviePlayerController.<br />
But MPMoviePlayerController view is always top of all layers, so I can't draw on the video.</p>
<p>I appreciate any helps in advance.
</p></description>
		</item>
		<item>
			<title>Blue Ether on "CCUIViewWrapper - wrapper for manipulating UIViews using Cocos2D"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/6889#post-40440</link>
			<pubDate>Sun, 06 Jun 2010 16:24:08 +0000</pubDate>
			<dc:creator>Blue Ether</dc:creator>
			<guid isPermaLink="false">40440@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I wanted to share a class I've written I'm calling CCUIWrapper, which acts as a way of manipulating UIViews via Cocos2D methods.  It's not the most momumental class ever written and most of what it does is simple but a few of the pieces took a bit of tinkering and head scratching to put together.  I'm sharing this because I think many people might find it very useful, and I'm inclined to believe that it should even be included as part of Cocos2D.  UIViews can do many things that Cocos cannot, and the differences between the two systems make them very confusing to merge together.  Hopefully this class simplifies the process for people.</p>
<p>Applications:<br />
I originally started developing this to be used for fading and moving AdMob ads.  I have continued tinkering with it for use with an iPad app that has a few UITextFields and where rotations are needed to allow for orientation changes.</p>
<p>First, how to initialize a UIView with the wrapper:<br />
<pre><code>UIView *myView	= [[[UIView alloc] init] autorelease];
CCUIViewWrapper *wrapper = [CCUIViewWrapper wrapperForUIView:myView];
wrapper.contentSize = CGSizeMake(320, 160);
wrapper.position = ccp(64,64);
[self addChild:wrapper];

// cleanup
[self removeChild:wrapper cleanup:true];
wrapper = nil;</code></pre>
<p>The wrapper puts a retain on its UIView, so you can autorelease it as you create it.  In practice though, you probably want to maintain a seperate reference to the UIView since you don't want to have to keep casting and type checking the UIView to see if its actually the UITextField (or whatever else) that you created.</p>
<p>The view doesn't have to be initialized with a frame size (though it can be), because setting the content size of the wrapper automatically resizes the frame.  Also, adding the wrapper to another Cocos object will automatically add its associated uiView to the Cocos openGLView window.</p>
<p>Next, usage:<br />
<pre><code>[wrapper runAction:[CCRotateTo actionWithDuration:.25f angle:180]];
wrapper.position = ccp(96,128);
wrapper.opacity = 127;
[wrapper runAction:[CCScaleBy actionWithDuration:.5f scale:.5f];
wrapper.visible = false;</code></pre>
<p>After creation, you can basically treat the wrapper as if it were the UIView.  Anywhere you position the wrapper, that's where the UIView will be.  Similarly, you can modify visibility, opacity, rotation, and scale.  The UIView is automatically updated.  This includes modifications made via actions.</p>
<p>Questions / Limitations / Missing functionalities:<br />
- I've tried to make the wrapper include transforms of its parents.  However, I'm not sure if this includes scale or opacity, as I haven't tested it.  Honoring parent rotations was a bit of work to get set up, and I didn't need to worry about honoring parent scale or parent opacity for my application.<br />
- I'm not sure if rotations will work right unless the anchor point of the wrapper is at .5,.5 (though position should work fine).  I was only using center anchor points, so it didn't come up.<br />
- I'm also not sure if you add subviews to your UIView whether those will be positioned properly, though I assume they will<br />
- If you transform the wrapper's parent/grandparent/etc, the wrapper can handle that, but it needs to be told it has to recalculate the uiView's position.  You can do this by calling: [wrapper updateUIViewTransform];<br />
If, for example, you are running a CCRotateTo action on the wrapper's parent, then updateUIViewTransform will need to be called every frame during that action.  Maybe there is a better way of integrating the update method so that Cocos will automatically trigger the code?  I'm not very familiar with the very low level of how Cocos lets children know their parent has changed transformation.</p>
<p>Finally, here is the source:<br />
CCUIViewWrapper.h<br />
<pre><code>#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;cocos2d.h&#34;

@interface CCUIViewWrapper : CCSprite
	{
	UIView *uiItem;
	float rotation;
	}

@property (nonatomic, retain) UIView *uiItem;

+ (id) wrapperForUIView:(UIView*)ui;
- (id) initForUIView:(UIView*)ui;

- (void) updateUIViewTransform;

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

@implementation CCUIViewWrapper

@synthesize uiItem;

+ (id) wrapperForUIView:(UIView*)ui
	{
	return [[[self alloc] initForUIView:ui] autorelease];
	}

- (id) initForUIView:(UIView*)ui
	{
	if((self = [self init]))
		{
		self.uiItem = ui;
		return self;
		}
	return nil;
	}

- (void) dealloc
	{
	self.uiItem = nil;
	[super dealloc];
	}

- (void) setParent:(CCNode *)parent
	{
	if(parent == nil)
		[uiItem removeFromSuperview];
	else if(uiItem != nil)
		[[[[CCDirector sharedDirector] openGLView] window] addSubview: uiItem];
	[super setParent:parent];
	}

- (void) updateUIViewTransform
	{
	float thisAngle, pAngle;
	CGAffineTransform	transform = CGAffineTransformMakeTranslation(0, [[UIScreen mainScreen] bounds].size.height);

	for(CCNode *p = self; p != nil; p = p.parent)
		{
		thisAngle = CC_DEGREES_TO_RADIANS(p.rotation);

		if(!p.isRelativeAnchorPoint)
			transform = CGAffineTransformTranslate(transform, p.anchorPointInPixels.x, p.anchorPointInPixels.y);

		if(p.parent != nil)
			{
			pAngle = CC_DEGREES_TO_RADIANS(p.parent.rotation);

			transform = CGAffineTransformTranslate(transform,
						(p.position.x * cosf(pAngle)) + (p.position.y * sinf(pAngle)),
						(-p.position.y * cosf(pAngle)) + (p.position.x * sinf(pAngle)));
			}
		else
			transform = CGAffineTransformTranslate(transform, p.position.x, -p.position.y);

		transform = CGAffineTransformRotate(transform, thisAngle);
		transform = CGAffineTransformScale(transform, p.scaleX, p.scaleY);

		transform = CGAffineTransformTranslate(transform, -p.anchorPointInPixels.x, -p.anchorPointInPixels.y);
		}

	[uiItem setTransform:transform];
	}

- (void) setVisible:(BOOL)v
	{
	[super setVisible:v];
	[uiItem setHidden:!v];
	}

- (void) setRotation:(float)protation
	{
	[super setRotation:protation];
	[self updateUIViewTransform];
	}

- (void) setScaleX:(float)sx
	{
	[super setScaleX:sx];
	[self updateUIViewTransform];
	}

- (void) setScaleY:(float)sy
	{
	[super setScaleY:sy];
	[self updateUIViewTransform];
	}

- (void) setOpacity:(GLubyte)opacity
	{
	[uiItem setAlpha:opacity/255.0f];
	[super setOpacity:opacity];
	}

- (void) setContentSize:(CGSize)size
	{
	[super setContentSize:size];
	uiItem.frame	= CGRectMake(0, 0, self.contentSize.width, self.contentSize.height);
	uiItem.bounds	= CGRectMake(0, 0, self.contentSize.width, self.contentSize.height);
	}

- (void) setAnchorPoint:(CGPoint)pnt
	{
	[super setAnchorPoint:pnt];
	[self updateUIViewTransform];
	}

- (void) setPosition:(CGPoint)pnt
	{
	[super setPosition:pnt];
	[self updateUIViewTransform];
	}

@end</code></pre>
<p>EDIT: I should note, I developed this for 0.99.2.  I haven't tested it with 0.99.3.
</p></description>
		</item>
		<item>
			<title>rizer on "Resizing CCDirector"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28664#post-141230</link>
			<pubDate>Wed, 25 Jan 2012 19:40:21 +0000</pubDate>
			<dc:creator>rizer</dc:creator>
			<guid isPermaLink="false">141230@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I'm working on a pixel art editing app for the iPad that combines UIKit with cocos2d. I've implemented the canvas using cocos2d, but I'm having an issue switching in and out of documents as it requires a resizing of the CCDirector. The desired workflow is be to be in the gallery view (entirely UIKit), open a document in the art board view (UIKit with one cocos2d Open GL view), return to the gallery view, and then open another document of a different size in the art board view. My code at the moment for constructing the art board view controller is:</p>
<p><code><br />
- (id)initWithDocument:(PixakiDocument*)pixakiDocument<br />
{<br />
	if(self = [super init])<br />
	{<br />
		[self setSelectedTool:PXOArtboardToolBrush];<br />
		[self setSelectedColor:[UIColor redColor]];</p>
<p>		[self setDocument:pixakiDocument];</p>
<p>		// cocos2d initialisation<br />
		CCDirector *director = [CCDirector sharedDirector];</p>
<p>		[director setProjection:kCCDirectorProjection2D];<br />
		EAGLView *glView = [[CCDirector sharedDirector] openGLView];<br />
		if(!glView)<br />
		{<br />
			NSLog(@"Should always get here");<br />
			glView = [EAGLView viewWithFrame:CGRectMake([[self document] width]/26.0, [[self document] height]/26.0, [[self document] width], [[self document] height])<br />
								 pixelFormat:kEAGLColorFormatRGBA8	// kEAGLColorFormatRGBA8<br />
								 depthFormat:0						// GL_DEPTH_COMPONENT16_OES<br />
					  ];<br />
			// attach the openglView to the director<br />
			[director setOpenGLView:glView];<br />
		}<br />
		else<br />
		{<br />
			[director reshapeProjection:CGSizeMake([[self document] width], [[self document] height])];<br />
			[[director openGLView] setFrame:CGRectMake([[self document] width]/26.0, [[self document] height]/26.0, [[self document] width], [[self document] height])];<br />
		}</p>
<p>		// Run the intro Scene<br />
		[self setCanvasLayer:[[CanvasCCLayer alloc] initWithLayers:[[self document] layers] documentInfo:[[self document] documentInfo] width:[[self document] width] height:[[self document] height]]];</p>
<p>		if([[CCDirector sharedDirector] runningScene] == nil)<br />
		{<br />
			[[CCDirector sharedDirector] runWithScene:[CanvasCCLayer sceneWithCCLayer:[self canvasLayer]]];<br />
		}<br />
		else<br />
		{<br />
			NSLog(@"replacing scene");<br />
			[[CCDirector sharedDirector] replaceScene:[CanvasCCLayer sceneWithCCLayer:[self canvasLayer]]];<br />
		}</p>
<p>		[[glView layer] setMagnificationFilter:kCAFilterNearest];</p>
<p>		[CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_RGBA8888];</p>
<p>		[director setDisplayStats:kCCDirectorStatsNone];</p>
<p>		// Set texture format<br />
		[CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_RGBA8888];<br />
		…<br />
	}</p>
<p></code></p>
<p>This works fine on the simulator, but on the device I have the following error when changing size:</p>
<p><code><br />
	Failed to make complete framebuffer object 8cdd<br />
	OpenGL error 0x0506 in -[CCSprite draw] 552<br />
	OpenGL error 0x0506 in -[CCSprite draw] 552<br />
	OpenGL error 0x0502 in -[EAGLView swapBuffers] 272<br />
</code></p>
<p>I did think about creating different instances of CCDirector, rather than use the sharedDirector singleton, but that seems rather messy. I'm open to any suggestions.</p>
<p>Thanks for your help,</p>
<p>Luke
</p></description>
		</item>
		<item>
			<title>RavalMatic on "UIKit or Cocos2D"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28663#post-141222</link>
			<pubDate>Wed, 25 Jan 2012 18:49:02 +0000</pubDate>
			<dc:creator>RavalMatic</dc:creator>
			<guid isPermaLink="false">141222@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>we are going to develop a Football manager for a customer. It will need a lots of menus and animations. I am familiar with cocos2d but not with UIKit. </p>
<p>Would you recomment to do the game in UIKit to take advantage of the layout tools for the menus? or would do do the game in cocos2d because sprites are easier to animate?
</p></description>
		</item>
		<item>
			<title>satishmahalingam on "Cocos2D and UIScrollView Solution"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28555#post-140605</link>
			<pubDate>Sun, 22 Jan 2012 04:33:33 +0000</pubDate>
			<dc:creator>satishmahalingam</dc:creator>
			<guid isPermaLink="false">140605@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Seems like there are quite a few posters asking how to integrate UIScrollView and Cocos2D. From searching on google, there are a couple of blogs that cover the basic concepts of UIScrollviews and Cocos2D, but none of them had any code samples. So, I decided to make one:</p>
<p>Blog Post explaining the process: <a href="http://www.satishmaha.com/blog/2012/01/08/integrating-cocos2d-and-uiscrollview-with-a-bonus/" rel="nofollow">http://www.satishmaha.com/blog/2012/01/08/integrating-cocos2d-and-uiscrollview-with-a-bonus/</a></p>
<p>GitHub Repo: <a href="https://github.com/satishmahalingam/Cocos2d-and-UIScrollView" rel="nofollow">https://github.com/satishmahalingam/Cocos2d-and-UIScrollView</a>
</p></description>
		</item>
		<item>
			<title>Gob00st on "Change z order between glView(cocos2d stuff) and two uikit views"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28522#post-140414</link>
			<pubDate>Fri, 20 Jan 2012 14:58:09 +0000</pubDate>
			<dc:creator>Gob00st</dc:creator>
			<guid isPermaLink="false">140414@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>My game is based on cocos2d, but I also have two uikit views. I want to be able to dynamic change the z order.<br />
Basically :</p>
<p>(1)Main menu scene(pure cocos2d) -&#62; (2)game scene(cocos2d with uikit View on top)<br />
                                 -&#62; (3)Setting Scene(pure uikit uiviewController)</p>
<p>From scene (1) user can either go to scene(2) or scene(3).</p>
<p>(1) Loading scene is simple pure cocos2d.<br />
cocos2d on top of everything.</p>
<p>(2) cocos2d top uikit<br />
Game scene is made of cocos2d + uikit(toolbar etc) and I need the cocos2d scene on top of the uikit view(will not cover all the uikit), so user will see both.</p>
<p>(3) uikit top cocos2d<br />
Just need to show a pure uikit table view, need to be on top of cocos2d scene.</p>
<p>I have got 3 question for this:<br />
1&#62;<br />
As far as I can say, I need to treat the cocos2d view(glView) and two uikit views as the same level subViews of a certain parent view, a uiNavgination controller or would normal view controller would just do ??</p>
<p>2&#62;<br />
Then I need dynamic change the z-order of those 3 views, how ?</p>
<p>3&#62;<br />
Would this whole thing work or there is a better solution for this?
</p></description>
		</item>
		<item>
			<title>Deivuh on "Show UIKit view on cocos2d game"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/25465#post-132543</link>
			<pubDate>Sat, 10 Dec 2011 02:35:54 +0000</pubDate>
			<dc:creator>Deivuh</dc:creator>
			<guid isPermaLink="false">132543@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi, I currently have a highscores board, which was made with iOS UIKit. Is there a way to show the view from a cocos2d MenuScene? </p>
<p>From what I have searched around the web, I've tried to do this by doing the following</p>
<p>[[[CCDirector sharedDirector] openGLView] addSubview:highScoresViewController.view];</p>
<p>But it doesn't do a thing.</p>
<p>Thanks in advance
</p></description>
		</item>
		<item>
			<title>trans416 on "Want To Clarify Something About UIKit with cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/24813#post-130844</link>
			<pubDate>Sat, 03 Dec 2011 04:31:45 +0000</pubDate>
			<dc:creator>trans416</dc:creator>
			<guid isPermaLink="false">130844@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I have ads running in my game right now and when it tries to load ads between admob and iAd, it slows down my game. Now is that suppose to happen with it? It drops to like 20 fps or so and then picks up again. Suggestions are appreciated. Thanks.
</p></description>
		</item>
		<item>
			<title>Sam on "How to communicate with a Cocos2d view in a Cocoa App?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/24750#post-130494</link>
			<pubDate>Thu, 01 Dec 2011 02:09:29 +0000</pubDate>
			<dc:creator>Sam</dc:creator>
			<guid isPermaLink="false">130494@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I have a smaller Cocos2d view that takes up about half of the screen. The other half contains buttons and sliders and such. What's the best way to pass the button and slider values into a layer in the Cocos2d view?</p>
<p>For instance, if I wanted to change the color or position of a CCSprite IN the Cocos2d view using the UI controls OUTSIDE of the Cocos2d view?</p>
<p>Do I pass in a reference to a layer? To the scene? </p>
<p>Note that the Cocos2d view is a subview of the app... the controls are NOT a subview of the Cocos2d view.
</p></description>
		</item>
		<item>
			<title>nixarn on "Weird slowdown issue after showing NSAlertView only on iOS 4.3"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/24708#post-130205</link>
			<pubDate>Tue, 29 Nov 2011 17:26:12 +0000</pubDate>
			<dc:creator>nixarn</dc:creator>
			<guid isPermaLink="false">130205@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Ok, so I posted here earlier about a problem but didn't get an answer. Now I've narrowed the problem to a really really simple example. My example runs perfect on any iOS version except 4.3, and it will have a smooth animation until the user touches the screen and the alert is shown, after that writing to the user default makes it sluggish. It's a really odd problem.</p>
<p>I'm using Cocos 1.0.1 and what I've done is created a Template project. And here's my HelloWorldLayer.m:</p>
<pre><code>// Import the interfaces
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;HelloWorldLayer.h&#34;

// HelloWorldLayer implementation
@implementation HelloWorldLayer

+(CCScene *) scene
{
	// &#039;scene&#039; is an autorelease object.
	CCScene *scene = [CCScene node];

	// &#039;layer&#039; is an autorelease object.
	HelloWorldLayer *layer = [HelloWorldLayer node];

	// add layer as a child to scene
	[scene addChild: layer];

	// return the scene
	return scene;
}

// on &#34;init&#34; you need to initialize your instance
-(id) init
{
	// always call &#34;super&#34; init
	// Apple recommends to re-assign &#34;self&#34; with the &#34;super&#34; return value
	if( (self=[super init])) {

		// create and initialize a Label
		label = [CCLabelTTF labelWithString:@&#34;Hello World&#34; fontName:@&#34;Marker Felt&#34; fontSize:64];

		// ask director the the window size
		CGSize size = [[CCDirector sharedDirector] winSize];

		// position the label on the center of the screen
		label.position =  ccp( size.width /2 , size.height/2 );

		// add the label as a child to this Layer
        [label runAction: [CCRepeatForever actionWithAction: [CCRotateBy actionWithDuration:5 angle:360]]];
		[self addChild: label];
        [self schedule: @selector(test:) interval:1];

        // Create random arrays
        a = [[CCArray array] retain];
        b = [[CCArray array] retain];

        for( int i = 0; i &#60; 100; i++ ) {
            [a addObject: [NSNumber numberWithInt:i]];
            [b addObject: [NSNumber numberWithInt:i]];
        }

        self.isTouchEnabled = YES;
	}
	return self;
}

- (void)test: (ccTime)delta {
    [label runAction: [CCSequence actions: [CCScaleTo actionWithDuration:0.25f scale:0.5f], [CCScaleTo actionWithDuration:0.25f scale:1.0f], nil]];

    // Write some random stuff to the userdefault
    NSUserDefaults *u = [NSUserDefaults standardUserDefaults];
    [u setObject: [a getNSArray] forKey:@&#34;a&#34;];
    [u setObject: [b getNSArray] forKey:@&#34;b&#34;];
    for( int i = 0; i &#60; 10; i++ )
        [u setInteger: i forKey: [NSString stringWithFormat: @&#34;i%d&#34;, i]];

}

- (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
    [[[UIAlertView alloc] initWithTitle:@&#34;Alert&#34; message:@&#34;Nothing to see here&#34; delegate:self cancelButtonTitle:@&#34;Cancel&#34; otherButtonTitles:@&#34;Why not&#34;, nil] show];
}

// on &#34;dealloc&#34; you need to release all your retained objects
- (void) dealloc
{
	// in case you have something to dealloc, do it in this method
	// in this particular example nothing needs to be released.
	// cocos2d will automatically release all the children (Label)

	// don&#039;t forget to call &#34;super dealloc&#34;
	[super dealloc];
}
@end</code></pre></description>
		</item>
		<item>
			<title>MaKo34 on "cocos2d with uikit table layer order"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/23093#post-127326</link>
			<pubDate>Mon, 21 Nov 2011 11:24:22 +0000</pubDate>
			<dc:creator>MaKo34</dc:creator>
			<guid isPermaLink="false">127326@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Im following the excellent tutorial Integrate cocos2d and UIKit [http://bobueland.com/cocos2d/?p=259 ]</p>
<p>its working very well, but I need some sprites that move on my app to be on top of a tableView, I have tried with the property z, for cocos 2d but doesnt seem to work to place the sprite on top of the table,</p>
<p>'<br />
tablaMenuBloq = [[[UITableView alloc]initWithFrame:CGRectMake(40, -10, 150, 210) style:UITableViewStylePlain]autorelease];<br />
    tablaMenuBloq.transform = CGAffineTransformMakeRotation( ( 90 * M_PI ) / 180 );</p>
<p>    tablaMenuWrapper =[CCUIViewWrapper wrapperForUIView:tablaMenuBloq];<br />
    [self addChild:tablaMenuWrapper];</p>
<p>    //first sprite<br />
    TSprite *ez = [TSprite spriteWithFile:@"butonA.png"]; //lets create a TSprite, named EZ, and the file is Easy.png.<br />
    [ez SetCanTrack:YES];//The sprite can be tracked.</p>
<p>    [self addChild: ez z:2 tag:easySprite]; //lets add a tag to the sprite, in order to identify it later<br />
    ez.position = ccp(290,300);//position of the sprite<br />
    [TSprite track:ez];//and lets add this sprite to the tracked array.<br />
'<br />
Please note the sprite code created after the table also,</p>
<p>So how can I address this?</p>
<p>thanks a lot!
</p></description>
		</item>
		<item>
			<title>nathanclark80 on "UINavigationController and Cocos2d popViewControllerAnimated scene freezes"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/22835#post-126333</link>
			<pubDate>Wed, 16 Nov 2011 15:02:00 +0000</pubDate>
			<dc:creator>nathanclark80</dc:creator>
			<guid isPermaLink="false">126333@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I am creating an animated book using cocos2d. My setup is:<br />
! scene per UIViewController.</p>
<p>When I push a UIViewController on the navigation stack the scene loads perfectly, however when I pop a UIViewController, that UIViewController's scene is frozen. </p>
<p>I think this has to do with how I have my UIViewController organized. Here is my typical UIViewController:</p>
<pre><code>/// Sets up the Cocos2d scene
- (void)setupCocos2D {
    EAGLView *glView = [EAGLView viewWithFrame:self.view.bounds
                                   pixelFormat:kEAGLColorFormatRGB565	// kEAGLColorFormatRGBA8
                                   depthFormat:0                        // GL_DEPTH_COMPONENT16_OES
                        ];
    glView.autoresizingMask = UIViewAutoresizingFlexibleWidth &#124; UIViewAutoresizingFlexibleHeight;
    [self.view insertSubview:glView atIndex:0];
    [[CCDirector sharedDirector] setOpenGLView:glView];
    CCScene *scene = [Page2Layer scene];
    [[CCDirector sharedDirector] runWithScene:scene];
}</code></pre>
<pre><code>- (void) viewWillAppear:(BOOL)animated
{

    [self setupCocos2D];
    [super viewWillAppear:animated];
}</code></pre>
<pre><code>// Move to the next page
- (IBAction)nextAction:(id)sender {

// This cleans up the scene before moving on.
    [[CCDirector sharedDirector] end];
    Page3ViewController *vc = [[Page3ViewController alloc] initWithNibName:nil bundle:nil];
    [self.navigationController pushViewController:vc animated:YES];
    [vc release];
}</code></pre>
<pre><code>// Pop to the last page
- (IBAction)backAction:(id)sender {
    [self.navigationController popViewControllerAnimated:YES]; 

}</code></pre>
<p>Any ideas on there I'm going wrong?
</p></description>
		</item>
		<item>
			<title>paulcurtis on "Multiple UI Text Fields and Date Picker"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/22749#post-125949</link>
			<pubDate>Mon, 14 Nov 2011 10:45:36 +0000</pubDate>
			<dc:creator>paulcurtis</dc:creator>
			<guid isPermaLink="false">125949@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>I realise that this is a common question but i've never really found a decent set of answers yet it's something i would imagine is really quite common.</p>
<p>What is the best way of including more than one UITextField in a scene?<br />
And is it possible to use the iPhones rotating date/number widgets in a scene?</p>
<p>I've managed to get a single text field up by forcing first responder. But the field doesn't seem to style as a field and i can't get a second field working so you can click on it and/or use the NEXT/PREV buttons in the keyboard.</p>
<p>I'm just adding the UI elements to the layer via addChild. I don't need the layer to rotate or anything and it's purely for asking for some information about the player.</p>
<p>I've got several cocos2d books, googled heavily but never really found good examples of integrating UIKit controls. I've seen the UIKit wrapper for cocos2d but that seems to just be about allowing the UIkit elements to transform as part of a CCNode. That's not so important for me right now</p>
<p>Can anyone offer some advise?</p>
<p>thanks<br />
Paul
</p></description>
		</item>
		<item>
			<title>Simon Cragg on "[GAME] Tresk"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/22455#post-124612</link>
			<pubDate>Sat, 05 Nov 2011 16:13:41 +0000</pubDate>
			<dc:creator>Simon Cragg</dc:creator>
			<guid isPermaLink="false">124612@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Tresk brings a refreshing twist to the classic sliding tile puzzle game!  Rotate, Slide and Flip your way through 36 challenging boards, over 6 galaxies, and across 4 game modes!</p>
<p>You can download Tresk from iTunes here:<br />
<a href="http://itunes.apple.com/us/app/tresk/id452609955?ls=1&#38;mt=8">http://itunes.apple.com/us/app/tresk/id452609955?ls=1&#038;mt=8</a></p>
<p>It's FREE to download and if you enjoy playing you can unlock additional puzzle packs via various In-App purchasing options.</p>
<p><img src="http://www.cocos2d-iphone.org/games/scraper/images/452609955/screenshot_1.png" /></p>
<p>I really appreciate all of the help I got from other cocos2d users!<br />
Please write an honest review on the app store and report directly back here about any bugs.</p>
<p>Regards<br />
Simon
</p></description>
		</item>
		<item>
			<title>krstn on "UIKit controls visible after pushScene"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/22098#post-122803</link>
			<pubDate>Mon, 24 Oct 2011 17:45:17 +0000</pubDate>
			<dc:creator>krstn</dc:creator>
			<guid isPermaLink="false">122803@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>I've got a scene with two UIKit controls: UITextView. But on the same scene, user has possibility to go to another scene to check something and come back. After pushScene the UIKit controls are still visible on screen and user can tap on them and edit them.</p>
<p>How can I get rid of them so that they are not visible after pushScene?<br />
I don't want to remove one scene and add another, as I want to maintain whatever happened in it.</p>
<p>Any tips?
</p></description>
		</item>
		<item>
			<title>brits on "Inputting Text without UIKit wrapper"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/20993#post-116646</link>
			<pubDate>Sun, 18 Sep 2011 19:35:22 +0000</pubDate>
			<dc:creator>brits</dc:creator>
			<guid isPermaLink="false">116646@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I have seen the example for the UIKit wrapper where buttons are added using the wrapper. I would like to be able to enter text such as names and ages, date of birth etc..</p>
<p>I do not want to use the wrapper as I would like to make the interface space-age looking to go with my game fonts. </p>
<p>Searching for Cocos2d and text input in google, I came across the other non-iPhone versions of Cocos2d with now have a new text input library available.</p>
<p>Has anyone managed to convert this for use with the iOS? Would be really cool if Cocos for iPhone had it's own text input like the COcos for Android.
</p></description>
		</item>
		<item>
			<title>archagon on "Slow PNG loading vs. UIKit."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/21587#post-119919</link>
			<pubDate>Thu, 06 Oct 2011 19:24:03 +0000</pubDate>
			<dc:creator>archagon</dc:creator>
			<guid isPermaLink="false">119919@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I recently converted a UIKit view controller to Cocos2D, and I noticed that it was taking about a second longer to load using the exact same images. I decided to run a small benchmark of UIImage vs. CCSprite/CCTextureCache PNG loading (making sure that the UIImages were loaded immediately using this: <a href="https://gist.github.com/259357" rel="nofollow">https://gist.github.com/259357</a> ), and my results were as follows:</p>
<p>Testing UIKit...<br />
Small file time: 0.013457<br />
Medium file time: 0.048644<br />
Large file time: 1.038067<br />
Testing Cocos2D...<br />
Small file time: 0.015195<br />
Medium file time: 0.127928<br />
Large file time: 1.690473</p>
<p>It looks like Cocos2D takes about 2x as long to load medium/large PNGs as UIKit! Is there any way to improve loading performance?
</p></description>
		</item>
		<item>
			<title>byers on "openglview remove subview UI item"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/190#post-991</link>
			<pubDate>Fri, 19 Jun 2009 16:14:30 +0000</pubDate>
			<dc:creator>byers</dc:creator>
			<guid isPermaLink="false">991@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>greetings, </p>
<p>to add a couple of UITextFields to my cc2d layer, i'm constructing the uikit object manually, and ultimately adding it via: </p>
<p>[[[Director sharedDirector]openGLView]addSubview:submitText];</p>
<p>when i do a replace view on the director to switch to my next scene, all UI objects stay behind. </p>
<p>i know you can do a removeFromSuperview, but you would normally call that on a uiview instance.</p>
<p>is there anyway to remove an individual UI item after it's been added as a subview?</p>
<p>thanks!
</p></description>
		</item>
		<item>
			<title>praveencastelino on "cocs2d + UIKit + Text Rendering"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/21280#post-118351</link>
			<pubDate>Tue, 27 Sep 2011 10:16:57 +0000</pubDate>
			<dc:creator>praveencastelino</dc:creator>
			<guid isPermaLink="false">118351@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>My Game uses both Cocs2d(OpenGL) and UIKit. I'm using CCLabelBMFont to render text. I wanted to use the same text in UIkit also. How do we do that?<br />
 Do I have to write my own UIKit renderer to render the text from  *.fnt &#38; *.png file?
</p></description>
		</item>
		<item>
			<title>praveencastelino on "Cocos2d + UIKit + Scheduler problem"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/21251#post-118139</link>
			<pubDate>Mon, 26 Sep 2011 10:44:20 +0000</pubDate>
			<dc:creator>praveencastelino</dc:creator>
			<guid isPermaLink="false">118139@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I'm mixing both Cocos2d and UIKit. I'm displaying a UIKit UIView on top of EAGLView (i.e. adding UIView as subview to EAGLView). UIView acts like a modal view and it almost covers the entire screen. I was experiencing a performance problem whenever I performed UIView animation. I fixed this problem by pausing the CCDirector. But pausing the CCDirector, also pauses the scheduler method which is called for every second to update the state of the game. I want only the game to pause and not the scheduler. Is it possible to do this?</p>
<p> The documentation says that we are not supposed to use the NSTimer? Any workaround available?
</p></description>
		</item>
		<item>
			<title>brovador on "cocos2d + UIView Transitions"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/20123#post-112120</link>
			<pubDate>Tue, 23 Aug 2011 15:18:50 +0000</pubDate>
			<dc:creator>brovador</dc:creator>
			<guid isPermaLink="false">112120@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi everyone! I'm trying to mix some UIView Transitions (page curl in this case) with cocos2d.</p>
<p>The idea is to create a book-style application and make the transition between pages with UIKit and not using cocos-2d pagecurl transition.</p>
<p>I have the following:</p>
<ol>
<li>A cocos2d opengl view</li>
<li>An UIImageView with the screenshot of the cocos2d view. Created when the user press the next page button</li>
<li>A transition between this two views, like a normal transition between UIViews</li>
</ol>
<p>The problem is that, if I use the option UIViewAnimationOptionAllowAnimatedContent from the method -(void)transitionFromView:toView:duration:options:completion the UImageView dissapears and is replaced by the same cocos2d view. </p>
<p>I suppouse that it is by a OpenGL render context, buffers or something like that, but I don't have a clue how to resolve it.</p>
<p>Here is the sample code:</p>
<pre><code>- (void) nextScene:(CCScene*)nextScene {
    //cocos2dView is the main cocos2d opengl view

    UIImage *image = [self screenshotFromView:cocos2dView];
    UIImageView *v = [[UIImageView alloc] initWithImage:image];
    UIView *superview = [cocos2dView superview];

    [cocos2dView removeFromSuperview];
    [superview insertSubview:v atIndex:0];

    [UIView transitionFromView:v
                        toView:cocos2dView
                      duration:1
                       options:UIViewAnimationOptionTransitionCurlUp &#124; UIViewAnimationOptionAllowAnimatedContent
                    completion:^(BOOL finished){
                        [v release];
                    }
     ];

     [[CCDirector sharedDirector] replaceScene:nextScene];
}</code></pre>
<p>I need to have the option UIViewAnimationOptionAllowAnimatedContent to make the book page running during the transition and not have to stop it (for best user experience)</p>
<p>The animation runs but I see the same image (the cocos2d rendered scene) in the UIImageView and in the cocos2dView (??) Any ideas?</p>
<p>Thanks!
</p></description>
		</item>
		<item>
			<title>praveencastelino on "UIKit and Cococs2D"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/21061#post-117033</link>
			<pubDate>Tue, 20 Sep 2011 17:30:50 +0000</pubDate>
			<dc:creator>praveencastelino</dc:creator>
			<guid isPermaLink="false">117033@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>In my game, I'm using UITableview to display a list of game characters. I'm using the same image in Cocos2d openGL rendering.<br />
The name of the image is player.png &#38; <a href="mailto:player@2x.png">player@2x.png</a>. This works fine with the UITableview retina device but when I switch to Cococs2d openGL rendering, the image appears small. I found out the reason as the cocos2d was looking out for a image named 'player-hd.png' on retina device.<br />
I dont want to keep a copy of the same image with different naming convention. This problem happens when I try to use the same image on retina UIKit and Cocos2d.<br />
Are there any solutions for this?
</p></description>
		</item>
		<item>
			<title>Tenorm on "Cocos3D in my UITabBar"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/20704#post-115089</link>
			<pubDate>Fri, 09 Sep 2011 08:28:37 +0000</pubDate>
			<dc:creator>Tenorm</dc:creator>
			<guid isPermaLink="false">115089@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>I want to integrate a cocos3d view in a UITabBar based application, so that the user can select the cocos3d view in the tabbar. So I need to things:<br />
-&#62; Integrate cocos3d into a UIKit project<br />
-&#62; get a UIViewController that handles the cocos3d view</p>
<p>Any ideas?
</p></description>
		</item>
		<item>
			<title>FiberCore on "cocos2d is too quick to support UIScrollView scrolling?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/11361#post-64380</link>
			<pubDate>Wed, 24 Nov 2010 03:59:30 +0000</pubDate>
			<dc:creator>FiberCore</dc:creator>
			<guid isPermaLink="false">64380@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I create a UIScrollView in my cocos2d game. It works fine. But when I use setContentOffset with animated:YES to scroll the view, it only scroll for a short distance. When I set animated:NO, it works fine without animation. And It works fine in Simulator. I think because my frame rate is up to 60, the system cannot give auto scroll enough time?
</p></description>
		</item>
		<item>
			<title>andrewgold99 on "Running UIKit on top of Cocos2d 1.0.1, any new tricks to get it to work"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/20276#post-112815</link>
			<pubDate>Fri, 26 Aug 2011 11:25:14 +0000</pubDate>
			<dc:creator>andrewgold99</dc:creator>
			<guid isPermaLink="false">112815@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>For the store in my game Im looking to run a UIKit app on top of my game when you press a button, so far I can get it to come up by pausing the Director and adding a new viewController as a subview, but the UITableView doesn't give me the detail view when clicking on a Cell (Cell only highlights). I've read everything on the forum, but it mostly points to older versions of Cocos2d and the workarounds are not working under the new version.</p>
<p>Or is is better to recreate the store without UIKit using only Cocos2d, can you point me to somewhere to start me off if that's the case.</p>
<p>Other option is to go back to 0.99.5.</p>
<p>Any help would be appreciated.
</p></description>
		</item>
		<item>
			<title>MagicBeeens on "UIKitWrapper w/Transitions"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/15645#post-88586</link>
			<pubDate>Sat, 16 Apr 2011 19:53:54 +0000</pubDate>
			<dc:creator>MagicBeeens</dc:creator>
			<guid isPermaLink="false">88586@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi all.  I posted a question in a different thread, but I think it was old enough that it wasn't being monitored any longer by most people.  I am starting a new thread in hopes it will draw some attention.  I apologize for the tactic :)</p>
<p>There is a great thread w/some fantastic code for wrapping UIKit objects to be able to treat it as a CCNode.  The thread is:</p>
<p><a href="http://www.cocos2d-iphone.org/forum/topic/6889" rel="nofollow">http://www.cocos2d-iphone.org/forum/topic/6889</a></p>
<p>However, I have a somewhat newbie question.  In the thread the talk about how to get it to work with and respect scene transitions.  However, the info there is stated a bit plainly and since I'm on the newer side of the scale I am not able to follow it.  Could someone please help me out by fleshing it out a bit?  I am down to this problem and completing Game Center integration, and then I'm good to pull it out of beta and make a run at the App Store.</p>
<p>Thanks!
</p></description>
		</item>
		<item>
			<title>fonager on "Same project with iPhone, iPad and Mac targets or ?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/12397#post-69771</link>
			<pubDate>Thu, 06 Jan 2011 17:15:17 +0000</pubDate>
			<dc:creator>fonager</dc:creator>
			<guid isPermaLink="false">69771@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Just had a quick question before I begin looking into converting my game to Mac.</p>
<p>Is it possible to have the same project, containing both iPhone, iPad and Mac code, or are the project different types ?</p>
<p>Thanks!
</p></description>
		</item>
		<item>
			<title>Matthew Redler on "Why Use Cocos 2D Framework Over Plain Xcode?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/19990#post-111557</link>
			<pubDate>Sat, 20 Aug 2011 06:08:06 +0000</pubDate>
			<dc:creator>Matthew Redler</dc:creator>
			<guid isPermaLink="false">111557@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hey Guys,<br />
     I was just wondering the advantages of using the Cocos 2D framework inside Xcode instead of just using Xcode. Could someone explain?</p>
<p>Thanks,<br />
Matt
</p></description>
		</item>
		<item>
			<title>rawbeans on "UITextField on same opengl view as cocos2d nodes"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/19702#post-110277</link>
			<pubDate>Fri, 12 Aug 2011 07:07:38 +0000</pubDate>
			<dc:creator>rawbeans</dc:creator>
			<guid isPermaLink="false">110277@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Is there any way to add UIKit elements to the same opengl view as all of the cocos2d elements? When I add a UITextField using  		<code>[[[CCDirector sharedDirector] openGLView] addSubview: textField];</code> the magnifying glass does not include anything other than the text.
</p></description>
		</item>
		<item>
			<title>rawbeans on "UITextField with custom fonts possibly bitmap"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/19525#post-109175</link>
			<pubDate>Sun, 07 Aug 2011 00:31:27 +0000</pubDate>
			<dc:creator>rawbeans</dc:creator>
			<guid isPermaLink="false">109175@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Is there an easy way to use custom fonts with UITextFields and other UIKit objects? I would prefer to use the fnt files I created to use with CCLabelBMFont but using the plain ttf would be fine as well. Searching around on various forums all i can find is messy solutions that are more than 2 years old.
</p></description>
		</item>

	</channel>
</rss>

