ITeye博客

iPhone

共 5 篇文章

常用代码

**Degrees,Radians相互转换 ** CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;}; CGFloat RadiansToDegrees(CGFloat radians) {return radians * 180 / M_PI;}; 精确的时间差 NSTimeInterval begin = CFAbsoluteTimeGetCurrent(); ... NSTimeInterval gap = (CFAbsoluteTimeGetCurrent() - begin); 得到yea…

2011-04-01 10:29 · iPhone

自己写的一个图片展示

MediaComponentView.h // // MediaComponentView.h // MediaComponent // // Created by Jason Wang on 10/7/10. // Copyright 2010 __MyCompanyName__. All rights reserved. // #import <UIKit/UIKit.h> @interface MediaComponentView : UIView <UITableViewDelegate,UITableViewDataSource> { NSArray *images; NSUInt…

2010-10-13 15:49 · iPhone

iPhone 彩色图片转变为黑白图片

CGRect imageRect = CGRectMake(0, 0, image.size.width, image.size.height); // 创建gray的CGColorSpaceRef CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray(); // 创建CGContextRef CGContextRef context = CGBitmapContextCreate(nil, image.size.width, image.size.height, 8, 0, colorSpace, kCGImageAlphaNo…

2010-10-13 15:26 · iPhone · Java

iphone 处理单击和双击Touch

如果以不同的方式响应单击和双击事件时,就会出现复杂的情况。那么如何知道一个单击不是另一个双击的起始部分呢?一下代码可以用来处理处理这种情况: 在你的UIView或UIViewController里重载touchesBegan和touchesEnded方法: - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyobject]; if ([touch tapcount] == 2) { [nsobject cancelpreviousperformreque…

2010-09-24 00:40 · iPhone

ios4.0 uiwebview播放视频

在ios4.0以前的version,使用uiwebview播放视频只需要; UIWebView *videoView = [[uiwebview alloc] initWithFrame:CGRectMake(0,0,0,0)]; [self addsubview:videoview]; 但在ios4.0及以后,必须设置frame: UIWebView *videoView = [[uiwebview alloc] initWithFrame:CGRectMake(1,1,1,1)]; [self addsubview:videoview];

2010-09-22 15:52 · iPhone · Java