Fork me on GitHub

2012年2月29日

摘要: (1)直接调用系统的方法排序intNSMutableArray*array = [[NSMutableArrayalloc]init];[arrayaddObject:[NSNumbernumberWithInt:20]];[arrayaddObject:[NSNumbernumberWithInt:1]];[arrayaddObject:[NSNumbernumberWithInt:4]];NSArray*sortedArray = [arraysortedArrayUsingSelector:@selector(compare:)];for(inti =0; i < [sortedA 阅读全文
posted @ 2012-02-29 19:18 pengyingh 阅读(898) 评论(0) 推荐(1)
摘要: 1 // 2 // Sort.h 3 // Algorithm 4 // 5 // Created by 张 汉国 on 11-9-30. 6 // Copyright 2011年 __MyCompanyName__. All rights reserved. 7 // 8 9 #import <Foundation/Foundation.h>10 11 @interface Sort : NSObject{12 13 }14 15 //选择排序16 -(void)selectSortWithArray:(NSArray *)aData;17 //插入排序18 -(void)ins 阅读全文
posted @ 2012-02-29 19:10 pengyingh 阅读(196) 评论(0) 推荐(0)
摘要: %c 一个单一的字符%d 一个十进制整数%i 一个整数 //原来i%是这个区别啊%e, %f, %g 一个浮点数%o 一个八进制数%s 一个字符串%x 一个十六进制数%p 一个指针 //也挺特别的%n 一个等于读取字符数量的整数 //特别的东东%u 一个无符号整数%[] 一个字符集 //没见过%% 一个精度符号//一、NSString/*—————-创建字符串的方法—————-*/1、创建常量字符串。NSString *astring = @”This is a String!”;2、创建空字符串,给予赋值。NSString *astring = [[NSString alloc] init] 阅读全文
posted @ 2012-02-29 17:47 pengyingh 阅读(243) 评论(0) 推荐(0)
摘要: 准备两个CLLocation的对象,比如要计算某个位置与使用者当前位置的距离,则其 中一个CLLocation是userLocation = [locationManager location],locationManager是CLLocationManager的实例,并已执行[locationManager startUpdatingLocation];然后计算这两个CLLocation的距离(已格式化成12.34 km)[NSString stringWithFormat:@"%0.2f km",[userLocationdistanceFromLocation:loc 阅读全文
posted @ 2012-02-29 13:05 pengyingh 阅读(10226) 评论(0) 推荐(0)
摘要: 自定义uitableviewcell怎样实现跳转一个自定义UITableViewCell,里面包含一个button, 点击button跳转到其它视图:UIButton *btn =[ retain];btn.tag = indexPath.row;[btn addTarget:self action:@selector(响应函数:) forControlEvents:UIControlEventTouchUpInside];在tableview的编辑状态下:[self.tableview setEditing:YES animated:NO],令cell响应点击事件不会变颜色,但能响应事件,方 阅读全文
posted @ 2012-02-29 09:19 pengyingh 阅读(4883) 评论(0) 推荐(0)

导航