- 博客(63)
- 资源 (8)
- 收藏
- 关注
转载 IOS-- UIView中的坐标转换
// 将像素point由point所在视图转换到目标视图view中,返回在目标视图view中的像素值- (CGPoint)convertPoint:(CGPoint)point toView:(UIView *)view;// 将像素point从view中转换到当前视图中,返回在当前视图中的像素值- (CGPoint)convertPoint:(CGPoint)point from
2015-02-01 14:16:30
552
原创 软件开发教程---1,相机的调用
1,创建个新的项目,然后创建了viewcontrollview ,这里可以用xib 或者不用,我是用的xib文件,图片我是用的font字体文件 可以适配视网膜屏幕 ,是一种矢量文件,下面开始创建项目,ps:我用的最新版本的xcode6 创建完成后导入 avfoundtion这个库然后进入到xib文件中,拖一个uiimageview控件布满整个屏幕然
2014-08-08 14:04:29
943
原创 cocos2d-x TestLua 之 CCSequence (关于纹理图集)
local actionSequenceLayer = nil--不带参数的回调函数1 local function ActionSequenceCallback1() local label = CCLabelTTF:create("回调函数 1", "Marker Felt", 24) label:setPosition(size.width / 4, s
2013-11-24 22:04:17
1202
原创 ios ARC
arc 是IOS 5推出的新功能,全称是ARC(automatic Reference Counting) ,简单的说,就是代码中自动加入了 retainrelaese 原先需要手动添加的用来处理内存管理的引用计数的代码可以自动地由编译器完成 该机能在 iOS 5/ Mac OS X 10.7 开始导入,利用 Xcode4.2可以使用该机能。简单地理解ARC,就是通过指定的语法,让编译器
2013-11-15 21:41:08
849
原创 iOS 委托模式
委托模式" style="padding:0px; margin:0px; list-style:none; display:inline; width:567px; height:261px">委托Delegate是协议的一种,通过一种@protocol的方式实现,顾名思义,就是委托他人帮自己去做什么事。也就是当自己做什么事情不方便的时候,就可以建立一个委托,这样就可以委托他人帮自己去实
2013-11-15 21:40:11
819
原创 Cocos2d-x 粒子系统
第一种方法:自定义[cpp] //建立一个粒子系统 CCParticleSystem* pParticleSystem=new CCParticleSystemQuad(); //产生300个粒子 pParticleSystem->initWithTotalParticles(300); //设置粒子图片 pParticleSystem
2013-11-15 21:38:39
2295
原创 修改UISearchBar背景颜色
UISearchBar是由两个subView组成的,一个是UISearchBarBackGround,另一个是UITextField. 要IB中没有直接操作背景的属性。方法一:是直接将 UISearchBarBackGround移去。方法二:是创建一个UIView设置其颜色加载到UISearchBarBaceGround上作为UISearchBar的背景颜色方法一:
2013-10-31 09:22:51
3489
原创 百度地图 ----------冒泡加按钮
IOS百度地图视角跳到用户当前位置IOS百度地图开发实时路况IOS开发百度地图自动导航- (void)viewDidLoad { [super viewDidLoad]; _cacheAnnotationMDic=[[NSMutableDictionary alloc]init]; // 添加一个PointAnnotat
2013-10-31 09:22:08
3229
原创 UIScrollView,UIPageControl的结合使用
创建ViewController类.h文件里面:@interface HomeViewController : UIViewController{ UIButton *btn; UIScrollView *_scrollerView; UIPageControl *_page;}@end.m文件里面:-(void)loadV
2013-10-31 09:20:22
868
原创 UITabBarController,UITextView,UIToolbar,UISearchBar的综合应用
//存放视图控制器 NSMutableArray *_vcs=[NSMutableArray array]; //第一个视图 AViewController *a=[[AViewController alloc]init]; //指定navigat的根视图 UINavigationController *anavi=[[UINaviga
2013-10-31 09:19:20
1489
原创 五种常用手势
- (void)loadView{ UIView *aView = [[[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds] autorelease]; aView.backgroundColor = [UIColor whiteColor]; self.view = aView; [aVi
2013-10-31 09:18:14
1502
原创 ios 图片的截取
第一种:整个屏幕截取在ViewController中写的,这个类是一个视图控制器-(void)loadView{ //静态方法sharedApplication [[UIApplication sharedApplication]setStatusBarHidden:YES //把状态栏隐藏
2013-10-31 09:17:01
1199
原创 UITouch、CGContextRef简单综合应用
#import @interface KView:UIView {//放划线数组 NSMutableArray *array;//放删除时的线 NSMutableArray *array1; CGContextRef context;}@end#import "KView.h"@i
2013-10-31 09:16:21
942
原创 NSTimer的使用方法
初始化NSTimer(仅在绿色的地方不同)+ (NSTimer *)timerWithTimeInterval:(NSTimeInterval)ti target:(id)aTarget selector:(SEL)aSelector userInfo:(id)userInfo repeats:(BOOL)yesOrNo;+ (NSTimer *)scheduledTimer
2013-10-31 09:15:41
1120
原创 UIButton 使用
//这里创建一个圆角矩形的按钮UIButton *button1 = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 能够定义的button类型有以下6种,// typedef enum {// UIButtonTypeCustom = 0, 自定义风格// UIButtonTypeRoundedRect, 圆角矩形//
2013-10-31 09:14:52
1171
原创 UITextField的使用
初始化UITextFieldUITextField* text = [[UITextField alloc] initWithFrame:CGRectMake(10, 50, 300, 30)]; text.borderStyle = UITextBorderStyleRoundedRect; text.autocorrectionType = UITextAu
2013-10-31 09:14:10
949
原创 UILable使用
调整UILable里的字体大小以适合UILalbe的大小UILabel* lable = [[UILabel alloc]initWithFrame:CGRectMake(0, 280, 150, 40)];lable.text = @"wMAFAFAFEFFFFEA12";lable.font = [UIFont systemFontOfSize:22];lable.number
2013-10-31 09:13:20
804
原创 文件的读写和网络
文件的读文件的读取非常方便NSString类initWithContentsOfFile:encoding: errorstringWithContentsOfFile:encoding: error:writeToFile: atomically:encoding: error: 1首先创建文件路径(本项目以内的)
2013-10-31 09:12:31
1373
原创 使用Xcode创建plist文件和使用
//读取plist NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"plistdemo" ofType:@"plist"]; NSMutableDictionary *data = [[NSMutableDictionary alloc] initWithCon
2013-10-31 09:11:31
4690
转载 nsstring方法的使用以及nsarray的使用
NSString方法+(id) stringWithContentsOfFile:path encoding:enc error:err创建一个新字符串并将其设置为path指定的文件的内容,使用字符编码enc,如果非零,则返回err中错误+(id) stringWithContentsOfURL:url encoding:enc error:err创建一个新的字符串,并将其设置为u
2013-10-31 09:08:46
826
原创 NSString常见用法 不包括方法
//1、创建常量字符串。NSString *astring = @"This is a String!"; //2、创建空字符串,给予赋值。NSString *astring = [[NSString alloc] init];astring = @"This is a String!";[astring release];NSLog
2013-10-31 09:07:48
730
转载 cocos2dx飞机大战Cocos2d-x飞机实现
创建飞机类添加飞机到游戏场景处理飞机的动画处理飞机的移动创建子弹实现子弹的定时任务移动子弹完成子弹的碰撞检测player.h#ifndef __PLAYER_SCENE_H__#define __PLAYER_SCENE_H__#include "cocos2d.h"#include "SimpleAu
2013-10-24 09:33:23
1692
原创 cocos2dx教程之CCSprite
boolCCSprite::initWithFile(const char *pszFilename, const CCRect&rect){ CCAssert(pszFilename != NULL, ""); CCTexture2D *pTexture =CCTextureCache::sharedTextureCache()->addImage
2013-10-24 09:25:55
838
原创 cocos2dx教程之CCTextureCache
class CC_DLL CCTextureCache : publicCCObject{protected: CCDictionary*m_pTextures;Private: void addImageAsyncCallBack(floatdt);public:CCDictionary*snapshotTextures();sta
2013-10-24 09:25:21
779
原创 cocos2dx教程之CCTexture2D
class CC_DLL CCTexture2D : publicCCObject{public:boolinitWithData(const void* data, CCTexture2DPixelFormatpixelFormat, unsignedintpixelsWide, unsignedintpixelsHigh, constCC
2013-10-24 09:24:52
1182
原创 cocos2dx教程之CCImage
class CC_DLL CCImage :publicCCObject{public:boolinitWithImageFile(const char *strPath,EImageFormatimageType =kFmtPng);boolinitWithImageFileThreadSafe(const char *fullpath,E
2013-10-24 09:24:23
1148
原创 cocos2dx教程之CCAction
实现Node的动作,主要分为即时动作和延时动作+(id) action-(void) startWithTagert: (id)aTarget-(void) stop-(void) isDone-(void) step-(void) update-(void) pause-(void) unPause-(BOOL)
2013-10-24 09:23:50
681
原创 cocos2dx教程之CCMenu
//用图片来做按钮 CCMenuItemImage* myItems = CCMenuItemImage::itemFromNormalImage( "normal.png", "down.png", this, menu_selector(HelloWorld::myMenuCallback)
2013-10-24 09:23:09
880
原创 cocos2dx教程之CCLayer schedule
scheduleUpdate();schedule(schedule_selector(SchedulerUpdateAndCustom::tick));schedule(schedule_selector(SchedulerUpdateAndCustom::stopSelectors), 0.4f);void SchedulerUpdateAndCustom::updat
2013-10-24 09:22:28
1133
原创 cocos2dx教程之传感器事件
setAccelerometerEnabled(true);void AccelerometerTest::didAccelerate(CCAcceleration*pAccelerationValue){ CCDirector*pDir =CCDirector::sharedDirector(); CCSizewinSize =pDir
2013-10-24 09:21:50
1213
原创 cocos2dx教程之多点触控的实现
支持这种方式同样需要三个步骤:1,同Targeted Touch Delegate方式第一步2,将此节点添加到StandardDelegate(对于CCLayer可以省略此步),以实现一个可以点击的CCSprite为例: 在onEnter函数中添加 cocos2d::CCTouchDispatcher::sharedDispatcher()->addStan
2013-10-21 17:06:20
1305
原创 cocos2dx教程之CCLayer事件
BOOL isTouchEnabled_是否支持触摸响应。BOOL isAcceleromterEnabled_是否支持重力感应。1,在初始化阶段(init方法)将此层的属性设置为接收触摸消息setTouchEnabled(true);//开启屏幕触摸 2,重载函数virtual voidregisterWithTouchDispat
2013-10-21 16:34:50
678
原创 cocos2dx教程之CCLayerMultiplex
就是一个层的集合,它可以涵盖N个层,但一次只能激活一个。+(id) layerWithLayers: (CCLayer*)layer,…创建一个CCLayerMultiplex对象并返回,即封装了alloc、initWithLayers和autorelease方法,参数为组成该对象的层集合。-(id) initWithLayers: (CCLayer*)layervaLis
2013-10-21 16:33:20
919
原创 cocos2dx教程之CCLayerGradient
继承自CCLayerColor,增加了颜色渐变功能,CCLayerColor只能显示一种单一的颜色,而CCLayerGradient可以实现在两个颜色间逐渐过度的效果。因为有两种颜色,因此参数也会相应增加,但功能和CCLayerColor大同小异,就不赘述了,下面说一下方法:-(void) initWithColor: (ccColor4B)startfadingTo: (ccColo
2013-10-21 16:32:29
1190
原创 cocos2dx教程之CCLayerColor
CCLayer的子类,在CCLayer的基础上增加了绘制颜色的功能。CCLayerColor新增的属性:GLubyteopacityccColor3B color_ccVerter2F squareVertices_[4]ccColor4F squareColors_[4]ccBlendFuncblendFunc_-(id) initWi
2013-10-21 16:30:18
803
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人