自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(22)
  • 收藏
  • 关注

原创 设置图片大小和截屏

-(UIImage*)scaleToSize:(UIImage*)img size:(CGSize)size { // 创建一个bitmap的context // 并把它设置成为当前正在使用的context UIGraphicsBeginImageContext(size); // 绘制改变大小的图片 [img drawInRect:

2013-08-23 20:22:41 1120

原创 万能公式,想得到什么数字就能得到什么数字

NSString *string = @"测试sting14fkj测试5"; NSMutableArray *mutArr = [[NSMutableArray alloc] init]; for (int i = 0; i<string.length; i++) { NSString *instanceStr = [string sub

2013-06-13 09:39:17 725

原创 UIView 那些事

UILabel * nameLabel = [[UILabel alloc]init]; //定位label(x,y,长,高) nameLabel.frame = CGRectMake(10, 100, 100, 30); nameLabel.text = @"Ios30班"; nameLabel.textColor = [UIColor redColor];//设

2012-08-16 14:31:52 318

原创 同步 异步请求

//新建一个URL NSURL *url=[NSURL URLWithString:@"http://api.hudong.com/iphonexml.do?type=focus-c"]; //创建一个GET请求 cachePolicy:缓存 NSURLRequestReloadRevalidatingCacheData :忽略缓存数据

2012-08-16 12:20:26 562

原创 创建文件 大合集

//查找文件路径的函数 NSString *path= [[NSBundle mainBundle]pathForResource:@"student" ofType:@"txt"]; NSError *error=nil; //stringWithContentsOfFile 是读取 指定路径里的内容 NSUTF8StringEncoding:是对文本编码的

2012-08-16 12:18:00 330

原创 监听 通知

//单例方法 访问 //通知名字 [[NSNotificationCenter defaultCenter] postNotificationName:@"TOBTV" object:self];//接受中心[[NSNotificationCenter defaultCenter]addObserver:sel

2012-08-16 11:57:45 318

原创 NSString 字典 作业

//1.现有如下定义的字符串: NSMutableString * str=@“iphoneAndroid”,能不能对该字符串进行修改,如果能,请输出删除Android后的新字符串。 NSMutableString *str=[NSMutableString stringWithCapacity:2];//创建一个可变的字符串 [str appendString:@"iphoneA

2012-08-16 11:51:58 485

原创 查找文件路径

//查找文件path:路径。 bundle:捆绑 mainBundle:主要包 pathForResource:路径是 ofType:类型//注意本地是initWithContentsOfFile 网络的是initWithContentsOfURL NSString *path=[[NSBundle mainBundle]pathForResource:@"file"

2012-08-16 11:43:55 579

原创 字典 可变字典 大杂烩

//不可变字典 Student *s7=[[Student alloc]initWithName:@"jack"]; NSDictionary *dic=[[NSDictionary alloc]initWithObjectsAndKeys:s7,@"jack",@"26",@"age", nil]; NSString* str15=[dic o

2012-08-16 11:36:22 301

原创 NSArray 大杂烩

//声明一个数组 NSString *strOne=@"lxd"; NSString *strTow=@"abc"; NSString *strTree=@"def"; NSArray *strArray=[[NSArray alloc] initWithObjects:strOne,strTow,strTree, nil];//数组初始化方法 // 查看数

2012-08-16 11:15:07 313

原创 NSString 大杂烩

最简单的创建方法NSString *str=[NSString alloc]initWithString:@"lxd"];把int型 格式化成字符串int i=9;NSString *str=[NSString alloc]initWithFormat:@"%d",i];静态方法创建字符串NSString *str=[NSString stringWithFormat:@"

2012-08-16 11:11:00 309

原创 单例

单纯从编程的角度出发,单例可以节省不必要的内存开销屏蔽对象创建的复杂性创建单例+(AppStatus *)shareAppInstance{ if (shareAppStatus == nil) { shareAppStatus = [[AppStatus alloc] init]; } return shareAppStatus

2012-08-16 10:29:57 246

原创 一些有用的东西

[NSThread sleepForTimeInterval:6];  //时间停止6秒后在运行

2012-08-16 10:17:32 274

原创 label textField button 一些用法

///UILabelUILabel *nameLabel=[UIlabel alloc]init];//初始化nameLabel.frame=CGRectMake(10,100,100,30);//定义坐标和大小X,Y,W,H;nameLabel.text=@"IOS30班";//给LABEL 赋值nameLabel.textColor=[UIColor redColor];//文本的颜

2012-08-14 10:35:04 572

原创 UIView中插入子视图

UIView *redView=[[UIView alloc]initWithFrame:CGRectMake(100, 100, 50, 50)]; redView.backgroundColor=[UIColor redColor]; [self.view addSubview:redView]; [redView release]; UIV

2012-08-14 10:34:35 661

原创 改变视图的放大 缩小

- (void)loadView{ //必须先初始化一个底层的 View UIView *aView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)]; self.view = aView; [aView release]; UIView *twoView = [[UIView

2012-08-14 10:34:06 540

原创 Quartz 画笔

- (id)initWithFrame:(CGRect)frame{ self = [super initWithFrame:frame]; if (self) { _lineArray=[NSMutableArray array];//静态方法初始化 [_lineArray retain];//因为是静态方法初始化了 只要出这个函数就会释放 所以

2012-08-14 10:33:35 463

原创 UISegmentedControl and 动画

- (void)loadView{ //UISegmentedControl self.view=[[[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 480 )]autorelease]; self.view.backgroundColor=[UIColor blueColor];

2012-08-14 10:33:06 593

原创 手势,抖动

- (void)loadView{ self.view=[[[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)] autorelease]; self.view.backgroundColor=[UIColor whiteColor]; _imagView=[[UIImageView alloc

2012-08-14 10:32:34 625

原创 UIScrollView 基本用法

- (void)loadView{ self.view=[[[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)]autorelease]; self.title=self.detailTitle; /* textField=[[UITextField alloc]initWithFram

2012-08-14 10:31:47 648

原创 解析(xml,json)

第一步;导入解析文件配置XML :header search 添加 /usr/include/libxml2 如果报错前面加$(SDKROOT)导入libxml2.dylib 框架Other linker flags 添加:-lxml2 //创建XML 读取本地内容 NSString *path=[[NSBundle mainBundle] pathForRes

2012-08-14 10:30:26 423

原创 添加警报视图UIAlertView

UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"提示" message:@"单击了动态按钮" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil];  [alert show];//动画显示弹出警告    [alert release]; UIA

2012-08-12 11:41:33 472

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除