摘要: 以下内容来自网络,出处:http://blog.163.com/liran2001_81/blog/static/2416304020091125112622352/using System;using System.Collections.Generic;using System.ComponentModel;using System.Drawing;using System.Data;using System.Linq;using System.Text;using System.Windows.Forms;using System.Collections;namespace Tools{ 阅读全文
posted @ 2011-08-05 10:29 Penny●zheng 阅读(1432) 评论(0) 推荐(0)
摘要: dsfadsf原文出处(感谢原创作者):http://www.minroad.com/?p=58写入:NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);NSString *dataPath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@”sqlite.sqlite”];NSData *image=UIImagePNGRepresentation([UIImage imageName 阅读全文
posted @ 2011-04-26 14:57 Penny●zheng 阅读(753) 评论(0) 推荐(0)
摘要: objective c支持全局变量,用法和c/c++中相同。但是当我们要求如下时:如在A类里面定义的变量,在B类中不需要创建A类的实例就可访问和修改。 用全局变量来实现并不合适。此时我们需要做的是在A类的implementation文件中定义一个static变量,然后为A类定义静态成员函数(class method)来操作该变量。这样在其它类中你就不需要创建A类的实例来对static变量进行访问。虽然该static变量并不是A类的静态成员变量,但是也算达到了同样的效果。为什么不定义全局变量,关键就在于变量的作用域,static变量的作用域被限制在单一的文件中。代码可以如下所示: //examp 阅读全文
posted @ 2011-04-26 11:13 Penny●zheng 阅读(2234) 评论(0) 推荐(0)
摘要: @property是一个属性访问声明,扩号内支持以下几个属性:1,getter=getterName,setter=setterName,设置setter与getter的方法名2,readwrite,readonly,设置可供访问级别2,assign,setter方法直接赋值,不进行任何retain操作,为了解决原类型与环循引用问题3,retain,setter方法对参数进行release旧值再retain新值,所有实现都是这个顺序(CC上有相关资料)4,copy,setter方法进行Copy操作,与retain处理流程一样,先旧值release,再Copy出新的对象,retainCount为 阅读全文
posted @ 2011-04-26 09:43 Penny●zheng 阅读(504) 评论(0) 推荐(0)
摘要: 有时候在 iPhone 游戏中,既要播放背景音乐,同时又要播放比如枪的开火音效。此时您可以试试以下方法。首先要导入框架 AVFoundation.framework,头文件中 #import <AVFoundation/AVFoundation.h>。NSString *musicFilePath = [[NSBundle mainBundle] pathForResource:fileName ofType:@”wav”]; //创建音乐文件路径NSURL *musicURL = [[NSURL alloc] initFileURLWithPath:musicFilePath]; 阅读全文
posted @ 2011-04-25 14:35 Penny●zheng 阅读(420) 评论(0) 推荐(0)
摘要: 小弟使用的是Redhat9.0,最近把Win2000下的几个分区由FAT32转化为NTFS分 区后,造成Linux下无法加载.于是上网讨论及反复实验,终于成功即加载了NTFS,FAT32 分区,又可以显示中文文件夹,并对其进行操作.不敢独享,于是写此文,以供大家参考. 如果没有NTFS分区而只进行加载FAT32分区,只要将Linux汉化后(汉化过程请 参阅其他文章),修改/etc目录下的fstab和mtab即可启动Linux后自动加载FAT32分区. 例如: 假设要加载Windows下的D盘(FAT32分区,一般为hda5 )可如下修改: 在fstab中添加: /dev/hd5 /mnt/W. 阅读全文
posted @ 2011-04-22 17:17 Penny●zheng 阅读(512) 评论(0) 推荐(0)
摘要: Cocos2d作为一个开源的2D游戏引擎,最初是用python语言实现,mac app开发流行后,提供了一个Objective-C的版本。采用Cocos2d框架开发iphone游戏,极大提高了开发的速度。简单介绍参见百度百科,cocos2d官网。Cocos2d提供了两种touch处理方式,Standard Touch Delegate和Targeted Touch Delegate方式(参见CCTouchDelegateProtocol.h中源代码),CCLayer默认是采用第一种方式(参见CCLayer的 registerWithTouchDispatcher方法)。 在CCLayer子类中 阅读全文
posted @ 2011-04-09 21:54 Penny●zheng 阅读(1783) 评论(0) 推荐(0)
摘要: 一,iPhone OS 提供了关亍触摸(Touch)的以下 4 个事件响应凼数: (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {} (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {} (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {} (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *. 阅读全文
posted @ 2011-04-09 21:25 Penny●zheng 阅读(2338) 评论(1) 推荐(0)
摘要: 今天有个朋友测试 SQLite,然后得出的结论是:SQLite 效率太低,批量插入1000条记录,居然耗时 2 分钟!using System.Data;using System.Data.Common;using System.Data.SQLite;// 创建数据库文件File.Delete("test1.db3");SQLiteConnection.CreateFile("test1.db3");DbProviderFactory factory = SQLiteFactory.Instance;using (DbConnection conn = 阅读全文
posted @ 2011-04-07 10:43 Penny●zheng 阅读(2800) 评论(0) 推荐(2)
摘要: using System; using System.Windows.Forms; using Microsoft.Win32; namespace WidgetDeploy { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { //參考網址:http://msdn.microsoft.com/en-us/library/dd721906.aspx /* [HKEY_CLASSES. 阅读全文
posted @ 2011-03-17 09:03 Penny●zheng 阅读(514) 评论(0) 推荐(0)