- 博客(18)
- 收藏
- 关注
转载 iphone游戏开发中使用自定义字体的方法
<br />1、确定你的项目工程的resouce下有你要用的字体文件(.ttf,.odf)。 <br />2、然后在你的工程的Info.plist文件中新建一行(Add Row),添加key为:UIAppFonts,类型为Array或Dictionary都行;在UIAppFonts下再建立一个键值对,key为:Item 0,添加Value为XXX.ttf(你字体的名字,string型),可以添加多个,使用的时候写对应字体名字就行。<br />3、在你的项目里要用字体的时候 xx.font
2010-08-27 08:18:00 1471
转载 获取时间间隔 iphon
<br />- (NSString *)intervalSinceNow_YY_MM : (NSDate *) theDate {<br /> <br /> NSDate *eDate, *lDate;<br /> <br /> eDate = [theDate earlierDate: [NSDate date]];<br /> lDate = [theDate laterDate: [NSDate date]];<br /> <br />
2010-08-23 08:31:00 1190
转载 UITextField添加图片 文字居中 iphone
<br />最右侧加图片是以下代码,<br /> UIImageView *imgv=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"right.png"]];<br /> text.rightView=imgv;<br /> text.rightViewMode = UITextFieldViewModeAlways; <br />如果是在最左侧加图片就换成:<br />text.leftView
2010-08-19 10:42:00 1623
转载 UITextField添加图片 文字居中 iphone
<br />最右侧加图片是以下代码,<br /> UIImageView *imgv=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"right.png"]];<br /> text.rightView=imgv;<br /> text.rightViewMode = UITextFieldViewModeAlways; <br />如果是在最左侧加图片就换成:<br />text.leftView
2010-08-19 10:26:00 2124
转载 UITextField 垂直居 最右侧放图片
<br />最右侧加图片是以下代码,<br /> UIImageView *imgv=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"right.png"]];<br /> text.rightView=imgv;<br /> text.rightViewMode = UITextFieldViewModeAlways; <br />如果是在最左侧加图片就换成:<br />text.leftView
2010-08-19 10:17:00 1135
转载 iphone弹出键盘部分按键禁用
<br />实现这个函数:<br />- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string<br />{<br /> NSString *newString = [textFiled.text stringByReplacingCharactersInRange:range withString:
2010-08-19 10:03:00 1322
转载 iphone图标去掉光晕效果
<br />图片背景是透明的<br />如果想去掉光晕效果,就在info.plist中添加”Icon already includes gloss and bevel effects“,值为YES。<br />这个键值在xml格式下中叫UIPreRenderedIcon。
2010-08-19 09:57:00 2455
转载 显示大量图片 iphone
<br />用图片的时候一定要小心的alloc和release<br />推荐使用<br />NSString *path = [[NSBundle mainBundle] pathForResource:@"icon" ofType:@"png"];<br />myImage = [UIImage imageWithContentsOfFile:path];
2010-08-19 09:45:00 778
转载 字符串比较 忽略大小写 iphone
<br />//不考虑大小写比较字符串1<br /> NSString *astring01 = @"this is a String!";<br /> NSString *astring02 = @"This is a String!";<br /> BOOL result = [astring01 caseInsensitiveCompare:astring02] = = NSOrderedSame; <br /> NSLog(@"result:%d",re
2010-08-19 09:42:00 2262
转载 NSString+NSMutableString+NSValue+NSArray用法汇总
/******************************************************************************************* NSString *******************************************************************************************/ //一、NSString /*----------------创建字符
2010-08-19 09:41:00 1174
转载 图片裁剪
<br />#define START_X xxx<br />#define START_Y xxx<br />#define WIDTH xxx<br />#define HEIGHT xxx<br /><br />//传入原始图片对象<br />-(UIImage *)getImageFromImage:(UIImage*) superImage<br />{<br /> CGSize subImageSize = CGSizeMake(WIDTH, H
2010-08-19 09:36:00 1789
转载 获取documents路径 iphone
<br />NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);<br /> NSString *docDir = [paths objectAtIndex:0];<br /> //NSString *cp = [docDir stringByAppendingPathComponent:filename];<br /><br />
2010-08-19 09:18:00 1132
转载 关闭自动锁屏 iphone
复制代码[UIApplication sharedApplication].idleTimerDisabled=YES;不自动锁屏[UIApplication sharedApplication].idleTimerDisabled=NO;自动锁屏
2010-08-19 09:13:00 1868
转载 双缓冲 iphone
-(void)drawRect:(CGRect)rect{ NSString* imageName = [[NSString alloc]initWithFormat:@"b%d.png",m_Index]; UIImage* aImage = [UIImage imageNamed:imageName]; [imageName release]; int width = aImage.size.width;
2010-08-19 08:57:00 993
转载 改变键盘颜色 iphone
<br />1.只有这2种数字键盘才有效果。UIKeyboardTypeNumberPad,UIKeyboardTypePhonePad<br />2. 。keyboardAppearance = UIKeyboardAppearanceAlert <br />复制代码- (void)textViewDidBeginEditing:(UITextView *)textView{ NSArray *ws = [[UIApplication sharedApplication] windows];
2010-08-19 08:39:00 1178
原创 图片视线拉伸 iphone
<br />img = [[UIImage imageNamed:@"delete.png"]stretchableImageWithLeftCapWidth:216.0 topCapHeight:20.0]
2010-08-09 08:37:00 1102
原创 NSString类型转换成char类型
<br />将第n个进行转换<br />char r = [strValue characterAtIndex:n];<br />int i = [strValue characterAtIndex:n]-'0'
2010-08-03 15:04:00 1842
转载 获取系统时间 精确到毫秒 iphone
<br />NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];<br /> [dateFormatter setDateStyle:NSDateFormatterMediumStyle];<br /> [dateFormatter setTimeStyle:NSDateFormatterShortStyle];<br /> //[dateFormatter setDateFormat:@"
2010-08-02 14:14:00 2622
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人