2012年5月4日

在屏幕上画画(类似于手写输入键盘)

摘要: DrawInView.hDrawInView.h 1 #import <UIKit/UIKit.h> 2 3 @interface DrawInView : UIView 4 5 @property (nonatomic, retain) NSDictionary *pointsDictionary; 6 @property (nonatomic,assign) NSInteger beganCount; 7 @property (nonatomic, retain) NSMutableArray *pointsArray; 8 9 -(CGPoint) getCGPoint:(N 阅读全文

posted @ 2012-05-04 20:00 iYiming 阅读(621) 评论(0) 推荐(0) 编辑

2012年4月29日

iphone中Quarz 2D的使用

摘要: 1.可以依靠两个不同的库来满足我们绘图的需要,一个库是Quartz 2D,它是Core Graphics框架的一部分;另一个库是OpenGL ES,它是跨平台的图形库。2.OpenGL ES是跨平台图形库OpenGL的简化版、OpenGL ES是OpenGL的一个子集,OpenGL ES是专为iphone之类的嵌入式系统(因此缩写为字母ES)设计的。3.Quartz是一组函数、数据类型以及对象,专门用于直接在内存中对视图或图像进行绘制。Quartz将正在绘制的视图或图像视为一个虚拟的画布,并遵循所谓的绘画者模型。4.OpenGL ES以状态机的形式实现,OpenGL ES不允许执行直接影响视图 阅读全文

posted @ 2012-04-29 19:22 iYiming 阅读(642) 评论(0) 推荐(0) 编辑

2012年4月25日

Objective-C基础知识

摘要: 1.Objective-C是C语言的一个扩展集。Objective-C以C语言为基础,在该语言中添加了一些微妙但意义重大的特性。2. Xcode的.m拓展名表示文件含有Objective-C代码,应由Objective-C编译器处理。C编译器处理名称以.c结尾的文件,而C++编译器处理.cpp文件。在Xcode中,所有这些编译工作全由GNU编译器集合处理,这个编译器能够理解C语言的全部3个变体。3. Objective-C本质上就是C语言。4. Objective-C使用头文件来包含元素声明,这些元素包括结构体、符号常量、函数原型等。C语言使用#include来实现这个目的。5. #impor 阅读全文

posted @ 2012-04-25 16:29 iYiming 阅读(463) 评论(0) 推荐(0) 编辑

自定义AlertView

摘要: (注:需要添加CoreGraphics.framework)CustomAlertViewDelegate.h文件CustomAlertViewDelegate.h1 #import <Foundation/Foundation.h>2 @class CustomAlertView;3 4 @protocol CustomAlertViewDelegate <NSObject>5 -(void) alertView:(CustomAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex;6 @en 阅读全文

posted @ 2012-04-25 16:07 iYiming 阅读(483) 评论(0) 推荐(0) 编辑

2012年4月23日

内存管理

摘要: 摘自CocoaChina论坛:方法描述:(1)retain将一个对象的reference数量增加1(2)release将一个对象的reference数量减少1(3)autorelease在未来某些时候将reference数量减少1(4)alloc为一个对象分配内存,并设置保留值数量(retain count)为1(5)copy复制一个对象,并将其作为返回值。同时设置保留值数量(retain count)为1保留值数量规则(1)在一定的代码段中,使用copy,alloc和retain的次数应该和release,autorelease保持一致(2)使用类方法创建的对象(比如NSString的str 阅读全文

posted @ 2012-04-23 15:29 iYiming 阅读(133) 评论(0) 推荐(0) 编辑

@property 的本质

摘要: @property (nonatomic, retain) NSString *name;@synthesize name;这种方式的本质是:-(NSString *) name{return name;}-(void) setName:(NSStrng *) newName{if(name!=newName){[name release];name=[newName retain];}}对setName方法的解释:(1)为何要加name!=newName的判断 如果要是不加,传过来的参数如果是相同的,则newName会一直retain(2)为何[name release] 如... 阅读全文

posted @ 2012-04-23 15:25 iYiming 阅读(247) 评论(0) 推荐(0) 编辑

2012年3月25日

UITabBarController的用法

摘要: - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions{self.window= [[[UIWindowalloc]initWithFrame:[[UIScreenmainScreen]bounds]]autorelease];FirstViewController*firstController=[[FirstViewControlleralloc]init];//设置标题 firstController.title=@"Fi 阅读全文

posted @ 2012-03-25 17:16 iYiming 阅读(3999) 评论(0) 推荐(0) 编辑

UIActivityIndicator的用法

摘要: (1)创建 UIActivityIndicatorView*activityView=[[UIActivityIndicatorViewalloc]initWithFrame:CGRectMake(150,30,100,100)];(2)设置类型(activityIndicatorViewStyle) 三种类型: UIActivityIndicatorViewStyleWhiteLarge:大的白色的指示器 UIActivityIndicatorViewStyleWhite: 标准白色的指示器 UIActivityIndicatorViewStyleGray:为白色背景... 阅读全文

posted @ 2012-03-25 17:00 iYiming 阅读(1097) 评论(0) 推荐(0) 编辑

iPhone中WebService的使用

摘要: 使用的WebService是:http://www.webxml.com.cn/WebServices/WeatherWebService.asmx其中的getWeatherByCityName函数常使用的技术有:SOAP,HTTP GET,HTTP POST三种方式(一)SOAP(简单对象访问协议)方式当你使用SOAP时,必须用到POST方式(1)SOAP 1.1以下是请求实例:POST /WebServices/WeatherWebService.asmx HTTP/1.1Host: www.webxml.com.cnContent-Type: text/xml; charset=utf- 阅读全文

posted @ 2012-03-25 16:58 iYiming 阅读(1321) 评论(1) 推荐(0) 编辑

2012年3月18日

关于NSDate、NSDateFormatter和NSCalendar的使用

摘要: (1)NSDate 1>NSDate是系统的一个日期,时间类 2>返回系统当前的日期时间 +(id)date; 3>返回未来secs秒后的日期,时间 +(id)dateWithTimeIntervalSinceNow:(NSTimeInterval)secs; 4>未来达不到的时间 +(id)distantFuture; 5>过去达不到的时间 +(id)distantPast;(2)NSDateFormatter NSDate*date=[NSDatedate];NSDateFormatter*formatter=[[NSDateFormatteralloc... 阅读全文

posted @ 2012-03-18 19:43 iYiming 阅读(609) 评论(0) 推荐(0) 编辑

导航