Skip to content

Instantly share code, notes, and snippets.

View piaoapiao's full-sized avatar

piaoapiao

  • china shanghai
View GitHub Profile
@piaoapiao
piaoapiao / gist:3273030
Created August 6, 2012 09:58
标注神器
http://www.getmarkman.com/
@piaoapiao
piaoapiao / gist:3338051
Created August 13, 2012 07:57
RegexKitLite 导入问题
添加解决问题
libiconv.dylib
libicucore.A.dylib
@piaoapiao
piaoapiao / gist:3338250
Created August 13, 2012 08:30
replace iphone Number
NSString *str =@"123(3 24) +8678";
NSString *result = [str stringByReplacingOccurrencesOfString:@"(" withString:@" "];
result = [result stringByReplacingOccurrencesOfString:@")" withString:@" "];
result = [result stringByReplacingOccurrencesOfString:@"+86" withString:@" "];
result = [result stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
result = [result stringByReplacingOccurrencesOfString:@" " withString:@""];
NSLog(@"result:%@",result);
@piaoapiao
piaoapiao / gist:3338367
Created August 13, 2012 08:45
不错心得
-(void)add:(NSString *)data
{
[theLock lock];
NSLog(@"%@%d",data,ticketNumber);
ticketNumber--;
[theLock unlock];
}
- (void)viewDidLoad
{
@piaoapiao
piaoapiao / gist:3339189
Created August 13, 2012 10:24
Delete tableView
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
return YES;
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"come here");
}
@piaoapiao
piaoapiao / gist:3345864
Created August 14, 2012 02:37
下载一个文件进度显示
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[[NSURL alloc]initWithString:@"http://pic10.nipic.com/20101103/3970232_071442037843_2.jpg"]];
NSLog(@"path:%@",NSHomeDirectory());
[request setDownloadDestinationPath:[NSHomeDirectory() stringByAppendingPathComponent:@"1.jpg" ]];
request.delegate = self;
request.downloadProgressDelegate = self;
[request startAsynchronous];
}
- (void)setProgress:(float)newProgress
{
@piaoapiao
piaoapiao / gist:3346042
Created August 14, 2012 03:23
网络检测
Reachability *hostReach = [[Reachability reachabilityWithHostName:@"http://www.baidu.com"] retain];
[hostReach startNotifier];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(reachabilityChanged:)
name: kReachabilityChangedNotification object: nil];
- (void) reachabilityChanged: (NSNotification*)note{
@piaoapiao
piaoapiao / gist:3347092
Created August 14, 2012 07:04
select text in UIView
http://stackoverflow.com/questions/7979592/is-it-possible-to-select-the-text-rendered-by-core-text-in-iphone
@piaoapiao
piaoapiao / gist:3347204
Created August 14, 2012 07:27
select text in UIView
http://stackoverflow.com/questions/7979592/is-it-possible-to-select-the-text-rendered-by-core-text-in-iphone
@piaoapiao
piaoapiao / gist:3416315
Created August 21, 2012 15:06
小细节
btn.titleLable.frame = CGRectMack(20,43,54,45) 无效
[btn setTitleEdgeInsets:UIEdgeInsetsMake(0, a.origin.x +5,0,0)]; 有用