gtts
mcgtts · 共 195 篇文章
UILabel用法
/设置换行 UILabel*label; //设置换行 label.lineBreakMode = UILineBreakModeWordWrap; label.numberOfLines = 0; 换行符还是\n 比如NSString * xstring=@"lineone\nlinetwo" 记得要把label的高度设置的足够显示多行内容。 (void)LY_Display { UILabel *LY_Label = [[UILabel alloc] initWithFrame:CGRectMake(60, 180, 60, 30)]; [self.view addSubview:LY_…
2011-09-26 20:45 · ios开发 · 评论(0)
IPhone之UIScrollView [转载]
原文地址: IPhone之UIScrollView 作者: 飞舞的鸡毛 UIScrollView可以产生画轴的效果,可以在手机屏中左右滑动。 初始化代码为: mainView = [[UIScrollView alloc] initWithFrame:CGRectMake(0.0, 0.0, self.view.frame.size.width, 400)]; mainView.directionalLockEnabled = YES; mainView.pagingEnabled = YES; mainView.backgroundColor = [UIColor blueColor]; …
2011-09-22 15:55 · ios开发 · 评论(0)
NSBundle使用
NSBundle束,是一种特定的文件类型,其中的内容遵循特定的结构。 NSBundle的一个主要作用是 获取Resources文件夹中的资源。 使用主束来获取需要的资源文件: NSBundle *bundle = [NSBundle mainBundle]; NSString *plistPath = [bundle pathForResource:@"statedictionary" ofType:@"plist"]; 或者简写成一行: NSString *path = [[NSBundle mainBundle] pathForResource:@"sortednames" ofType…
2011-09-20 14:09 · objective-c · 评论(0)
Python 国际化
>>> help(locale) Help on module locale: NAME locale - Locale support. FILE c:\python27\lib\locale.py DESCRIPTION The module provides low-level access to the C lib's locale APIs and adds high level number formatting APIs as well as a locale aliasing engine to complement these. The aliasing engine in…
2011-09-18 11:14 · Python · 评论(0)
linux常用svn命令
1、将文件checkout到本地目录 svn checkout path(path是服务器上的目录) 例如:svn checkout svn://192.168.1.1/pro/domain 简写:svn co 2、往版本库中添加新的文件 svn add file 例如:svn addtest.php(添加test.php) svn add *.php(添加当前目录下所有的php文件) 3、将改动的文件提交到版本库 svn commit -m “LogMessage“ [-N] [--no-unlock] PATH(如果选择了保持锁,就使用–no-unlock开关) 例如:svn commi…
2011-09-17 23:55 · OS · 评论(0)
yum命令
软件包管理器 Yum(全称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及SUSE、CentOS中的 Shell 前端软件包管理器。基於 RPM 包管理,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软体包,无须繁琐地一次次下载、安装。 软体包来源 可供Yum下载的软体包包括 Fedora 本身的软体包以及源自rpmfusion和rpm.livna.org的Fedora Extras,全部是由Linux社区维护的,并且基本是自由软体。所有的包都有一个独立的GPG签名,主要是为了您的系统安全。而对於…
2011-09-17 15:52 · OS · 评论(0)
C++string类常用函数
转自: http://apps.hi.baidu.com/share/detail/30882356 string类的构造函数: string(const char *s); //用c字符串s初始化 string(int n,char c); //用n个字符c初始化 此外,string类还支持默认构造函数和复制构造函数,如string s1;string s2="hello";都是正确的写法。当构造的string太长而无法表达时会抛出length_error异常 string类的字符操作: const char &operator[](int n)const; const char &at(…
2011-09-14 15:10 · c/c++ · 评论(0)
python 的一些常用方法
1.生成随机数 02 import random #这个是注释,引入模块 03 rnd = random.randint(1,500)#生成1-500之间的随机数 04 05 2.读文件 06 07 f = open("c:\\1.txt","r") 08 lines = f.readlines()#读取全部内容 09 for line in lines 10 print line 11 3.写文件 12 f = open("c:\\1.txt","r+")#可读可写模式 13 f.write("123")#写入字符串 14 15 4.正则表达式,读取tomcat的日志并打印日期 16 17…
2011-09-11 00:17 · Python · 评论(0)
python 日期时间常用操作
关于python时间模块问题 #:当前时间时间戳 1312181113.31 print(time.time()) #将字符串转成时间戳 ts = '2011-08-01 14:15:40' b = time.mktime(time.strptime(ts,'%Y-%m-%d %H:%M:%S')) print(b) #返回指定时间的时间戳使用mktime d = datetime.datetime(1997,12,29,15,59,59) t = d.timetuple()#再转为元组 print(time.mktime(t)) #使用time的mktime方法返回时间戳 #将时间戳转成时…
2011-09-11 00:14 · Python · 评论(0)
mac系统如何显示和隐藏文件
苹果Mac OS X操作系统下,隐藏文件是否显示有很多种设置方法,最简单的要算在Mac终端输入命令。 显示/隐藏Mac隐藏文件命令如下(注意其中的空格并且区分大小写): 显示Mac隐藏文件的命令:defaults write com.apple.finder AppleShowAllFiles -bool true 隐藏Mac隐藏文件的命令:defaults write com.apple.finder AppleShowAllFiles -bool false 或者 显示Mac隐藏文件的命令:defaults write com.apple.finder AppleShowAllFiles…
2011-09-07 19:03 · OS · 评论(0)
mac osx vi 高亮显示设置
转自: Andrew's Blog Unfortunately the vim that ships with Mac OS X 10.5.* ( Leopard ) doesn’t have an optimized configuration file to allow for syntax highlighting , auto indentation , etc. To fix this, open a new Terminal window and enter these commands to open vim ’s configuration file: cd /usr/sha…
2011-09-07 12:43 · OS · 评论(0)
手势识别
注册: UISwipeGestureRecognizer *recognizer; recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFrom:)]; [recognizer setDirection:(UISwipeGestureRecognizerDirectionRight)]; [[self view] addGestureRecognizer:recognizer]; [recognizer release]; 处理: - (void)hand…
2011-09-03 17:19 · ios开发 · 评论(0)
“碰撞”探测
首先要向大家说明的是,所谓“碰撞”探测没有大家想想的那样复杂。丌是一提“碰撞” 探测就一定要考虑物理引擎。其实我们完全可以通过自己的算法实现“碰撞”探测。除了那 种复杂的连锁反应戒是需要逼真物理效果的游戏。 比如说,我们要做的“坦克大戓”游戏的“碰撞”探测就完全可以通过我们自己的简单 算法实现。读者也许会问:哇!那有多复杂啊! 试想,要有 8 个敌方坦克在满地图游荡,他们撞墙需要探测,互相之间需要探测,他 们一共还会随机发射出 0 到 8 个炮弹,每个炮弹的飞行和爆炸也都需要“碰撞”探测。而 且所有这些都是并发迚行的。如果增加地方 NCP 坦克到 12 个,这要多少个 if-else 组成啊…
2011-08-21 14:28 · ios开发 · 评论(0)