返回首页
当前位置: 主页 > 手机mobile >

iphone tip 總結

时间:2010-07-27 11:24来源:未知 作者:sam.huang 点击:
Quazt 2d真是個強大的庫,有對他的使用很是方便,下面就是一個獲取屏幕圖片的代碼: +(UIImage*)captureView:(UIView*)viewwithFrame:(CGRect)frame{ CGRectscreenRect=frame; //設置設備上下文大小 UIGraphicsBeginIm
  

       Quazt 2d真是個強大的庫,有對他的使用很是方便,下面就是一個獲取屏幕圖片的代碼:

  1. + (UIImage *)captureView:(UIView *)view withFrame:(CGRect)frame{ 
  2.     CGRect screenRect = frame; 
  3.      //設置設備上下文大小
  4.     UIGraphicsBeginImageContext(screenRect.size); 
  5.      //獲取設備上下文
  6.     CGContextRef ctx = UIGraphicsGetCurrentContext(); 
  7. //設備設置著色
  8.     [[UIColor blackColor] set]; 
  9.     CGContextFillRect(ctx, screenRect); 
  10.      
  11.     [view.layer renderInContext:ctx]; 
  12.      /獲取圖片
  13.     UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); 
  14.      
  15.     UIGraphicsEndImageContext(); 
  16.      
  17.     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];

顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
最新评论 查看所有评论
发表评论 查看所有评论
发布者资料
amw 查看详细资料 发送留言 加为好友 用户等级:高级会员 注册时间:2009-03-30 13:03 最后登录:2012-01-17 11:01
推荐内容