摘要:
匹配中文字符的正则表达式: [u4e00-u9fa5] 评注:匹配中文还真是个头疼的事,有了这个表达式就好办了 匹配双字节字符(包括汉字在内):[^x00-xff] 评注:可以用来计算字符串的长度(一个双字节字符长度计2,ASCII字符计1) 匹配空白行的正则表达式:ns*r 评注:可以用来删除空白行 匹配HTML标记的正则表达式:<(S*?)[^>]*>.... 阅读全文
随笔档案-2010年10月
Singleton Pattern in Objective-C
2010-10-27 19:58 by Tracy E, 512 阅读, 收藏,
摘要:
Creating a Singleton InstanceA singleton object acts as a kind of control center, directing or coordinating the services of the class. Your class should generate a singleton instance rather than multiple instances when there is conceptually only one instance (as with, for example, NSWorkspace). You 阅读全文
封装的一个用来下载图片的类
2010-10-20 09:33 by Tracy E, 601 阅读, 收藏,
摘要:
//// ImageDownloader// Created by Tracy E on 10-9-5.// Copyright 2010 tracy.cpp@gmail.com. All rights reserved.// @protocol ImageDownloaderDelegate;@interface ImageDownloader : NSObject{ NSString *imageURL; NSMutableData *activeDownload; NSURLConnection *imageConnection; id <ImageDownloaderD... 阅读全文
获取iphone的设备信息
2010-10-15 09:30 by Tracy E, 748 阅读, 收藏,
摘要:
Available Properties in UIDeviceuniqueIdentifier – identifier guaranteed to be unique for every devicename – arbitrary name found in General > About setting on devicesystemName – name of the OS running on the devicesystemVersion – current version of the OSmodel- model, such as ”iPhone” or ”iPod t 阅读全文
iphone-地理位置相关
2010-10-14 19:49 by Tracy E, 464 阅读, 收藏,
摘要:
调用google map应用: NSString *strUrl = [NSString stringWithFormat:@"http://maps.google.com/maps?q=%@",[[stationArr objectAtIndex:tag] _position]]; strUrl = [strUrl stringByAddingPercentEscapesUsingEncodin... 阅读全文
iphone-常用的对视图图层(layer)的操作
2010-10-14 10:47 by Tracy E, 779 阅读, 收藏,
摘要:
对图层的操作:1.给图层添加背景图片:myView.layer.contents = (id)[UIImageimageNamed:@"view_BG.png"].CGImage; 2.将图层的边框设置为圆脚myWebView.layer.cornerRadius = 8;myWebView.layer.masksToBounds = YES; 3.给图层添加一个有色边框myWebView.layer.borderWidth = 5; myWebView.layer.borderColor = [[UIColorcolorWithRed:0.52green:0.09blue 阅读全文
在iphone中获取格式化的时间
2010-10-11 11:21 by Tracy E, 650 阅读, 收藏,
摘要:
参看:http://blog.chinaunix.net/u2/66419/showart_2347823.htmlNSDateFormatter *dateFormatter = [[NSDateFormatteralloc] init];[dateFormatter setDateFormat:@"YYYY年MM月dd日"];NSString *currentDate = [dateFormatter stringFromDate:[NSDatedate]];NSLog(@"current date = %@",currentDate); 阅读全文
iphone程序中实现截屏的一种方法
2010-10-11 11:15 by Tracy E, 495 阅读, 收藏,
摘要:
在iphone程序中实现截屏的一种方法://导入头文件#import <QuartzCore/QuartzCore.h> //将整个self.view大小的图层内容创建一张图片imageUIGraphicsBeginImageContext(self.view.bounds.size);[self.view.layerrenderInContext:UIGraphicsGetCurrentContext()];UIImage*image= UIGraphicsGetImageFromCurrentImageContext();UIGraphicsEndImageContext(); 阅读全文
浙公网安备 33010602011771号