摘要: UIView设置背景图片可以使用如下代码: self.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"dula.png"]];但是,这段代码存在一个危险。alloc和init一个对象后,count就会加1,这时需要调用release方法来释放内存。设置UIView背景图片更为保险的方法是:self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@" 阅读全文
posted @ 2012-05-04 23:14 FoxBabe 阅读(332) 评论(1) 推荐(1) 编辑
摘要: iPhone系统的字体数量有限,并且多数对中文没有效果,下面介绍两种解决办法方法1: 添加对应的字体(.ttf或.odf)到工程的resurce,使用cocos2d中的FontLabel库,FontLabel继承于UILabel,象UILabel一样使用就好了 fontName直接使用添加的资源名字即可方法2; 1,添加对应的字体(.ttf或.odf)到工程的resurce,例如simkai.ttf 2,在info.plist中添加一项 Fonts provided by application (item0对应的value为simkai.ttf,添加多个字体依次添加就可以了) 3,... 阅读全文
posted @ 2012-05-04 23:08 FoxBabe 阅读(627) 评论(1) 推荐(1) 编辑
摘要: 将UIView的最初位置置为窗口之外,然后通过一个动画来实现UIView的飞入效果,固定好进入的位置。 [newvision setFrame:CGRectMake(-200,30,175,145)]; [UIView beginAnimations:nil context:nil]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:1]; //动画时长 [newvision setFrame:CGRectMake(5,30,175,14... 阅读全文
posted @ 2012-05-04 08:27 FoxBabe 阅读(558) 评论(0) 推荐(1) 编辑
摘要: 用UIImage加载图像的方法很多,最常用的是下面三种:一、用imageNamed函数引用[UIImage imageNamed:ImageName];二、用NSData的方式加载NSString *filePath = [[NSBundle mainBundle] pathForResource:fileName ofType:extension]; NSData *image = [NSData dataWithContentsOfFile:filePath]; [UIImage imageWithData:image];三,使用[UIImage imageWithContentOfFil 阅读全文
posted @ 2012-05-04 08:20 FoxBabe 阅读(434) 评论(0) 推荐(1) 编辑
摘要: 1、引入头文件#include <sys/sysctl.h>#include <mach/mach.h>2、检测函数//MARK: 可用内存- (double)availableMemory{ vm_statistics_data_t vmStats; mach_msg_type_number_t infoCount = HOST_VM_INFO_COUNT; kern_return_t kernReturn = host_statistics(mach_host_self(),HOST_VM_INFO,(host_info_t)&vmStats,&in 阅读全文
posted @ 2012-05-04 08:15 FoxBabe 阅读(644) 评论(3) 推荐(1) 编辑