博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2013年3月14日

摘要: 1、随机数的使用1)、arc4random() 比较精确不需要生成随即种子 使用方法 : 通过arc4random() 获取0到x-1之间的整数的代码如下: intvalue=arc4random()%x; 获取1到x之间的整数的代码如下: intvalue=(arc4random()%x)+1; 2)、CCRANDOM_0_1() cocos2d中使用 ,范围是[0,1] 使用方法: float random = CCRANDOM_0_1() * 5; //[0,5] CCRANDOM_0_1() 取值范围是[0,1] 3)、random() 需要初始化时设置种子 使用方法: srandom 阅读全文

posted @ 2013-03-14 16:42 酸梅拯救地球 阅读(166) 评论(0) 推荐(0)

摘要: 1.When a gesture recognizer recognizes its specified gesture, it sends an action message to its target. To create a gesture recognizer, you initialize it with a target and an action.Often, the target object is the view’s view controller.ypically, you create a gesture recognizer in your view controll 阅读全文

posted @ 2013-03-14 11:32 酸梅拯救地球 阅读(212) 评论(0) 推荐(0)