Quazt 2d真是個強大的庫,有對他的使用很是方便,下面就是一個獲取屏幕圖片的代碼:
- + (UIImage *)captureView:(UIView *)view withFrame:(CGRect)frame{
- CGRect screenRect = frame;
- //設置設備上下文大小
- UIGraphicsBeginImageContext(screenRect.size);
- //獲取設備上下文
- CGContextRef ctx = UIGraphicsGetCurrentContext();
- //設備設置著色
- [[UIColor blackColor] set];
- CGContextFillRect(ctx, screenRect);
- [view.layer renderInContext:ctx];
- /獲取圖片
- UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
- UIGraphicsEndImageContext();
- return newImage;
- }
經緯度計算距離:
CLLocation *here = [[CLLocation alloc] initWithLatitude:5.000f longitude:5.000f];
CLLocation *there = [[CLLocation alloc] initWithLatitude:6.000f longitude:6.000f];
[there getDistanceFrom:here];

