小糊涂的移动技术BLOG(Mobile Excite World)  
Mobile Dev Symbian/JavaMe/ Web Dev php/web 2.0/ Now Iphone.Opengles android is planning.
公告
  • i'm cnsoft. i am focus on mobile devlopment. symbian,javame,and now iphone, android is planning to be resarch. i am only one beginner。
    Donews Blog :http://blog.donews.com/cnsoft/
    Free AD: WB Editor 是支持中文 blog 写作的工具。



  • 欢迎支持我的GoogleADSENSE测试计划

  • 如果你看到了想要看的东西,不妨点击一下表示鼓励。
日历
<2009年3月>
22232425262728
1234567
891011121314
15161718192021
22232425262728
2930311234
统计
  • 随笔 - 165
  • 文章 - 2
  • 评论 - 237
  • 引用 - 1

导航

搜索

 

常用链接

随笔分类

随笔档案

相册

Links2me

最新评论

阅读排行榜

评论排行榜

 

 

想必大家都会有这个需求,如何管理物体对象? 用 STD::Vector 吗?

在object c 中我们可以如下操作。 

 

//Initialize the Array
spriteArray = [[NSMutableArray alloc] init];
 

 

//保存对象.

//Add mySprite to the array
[spriteArray addObject:[NSValue valueWithPointer:mySprite]];

//提取.

mySprite *tmpSprite = nil;
NSValue *pValue = [spriteArray objectAtIndex:0];
[pValue getValue:&tmpSprite];

 

这样就可以很轻松的管理对象了。

 

 

0
0
(请您对文章做出评价)
« 上一篇:Object C 内存管理的几个要点.
» 下一篇: Save UIView 's Snapshot.
posted on 2009-03-07 15:38 小糊涂的超级blog 阅读(57) 评论(0)  编辑 收藏 网摘
 
Copyright © 小糊涂的超级blog Powered by: 博客园 模板提供:沪江博客