iOS功能代码
cutescreen
专注iOS开发
展开
-
[iOS代码] 根据文字生成图片UIImage
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef context = CGBitmapContextCreate(NULL, dsize.width, dsize.height, 8, 4*dsize.width, colorSpace, kCGImageAlphaPremu原创 2013-05-09 19:57:57 · 1225 阅读 · 0 评论 -
[iOS代码] 页面中休眠功能的开启和关闭
- (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; //禁止休眠 [[UIApplication sharedApplication] setIdleTimerDisabled:YES]; } - (void)viewWillDisappear:原创 2013-05-09 19:53:21 · 590 阅读 · 0 评论 -
[iOS代码] 日期格式 时间戳
获取系统的当前时间: NSDateFormatter* dateFormatter = [[[NSDateFormatter alloc] init] autorelease]; [dateFormatter setLocale:[NSLocale currentLocale]]; [dateFormatter setTimeZone:[NSTimeZone systemTime原创 2013-05-03 16:39:10 · 386 阅读 · 0 评论 -
[iOS代码] 视图view如何截图 生成UIImage图片
#import UIImage* layerImage = nil; CGSize layerSize = self.contentScrollView.frame.size; UIGraphicsBeginImageContextWithOptions(layerSize, NO, 2.0); [self.contentScrollView.la原创 2013-05-01 19:06:31 · 542 阅读 · 0 评论 -
[iOS代码] 打开App Store评论页面
NSString* appid = @"403858572"; NSString* url = [NSString stringWithFormat: @"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=%@", appid];原创 2013-05-01 09:13:54 · 562 阅读 · 0 评论 -
[iOS代码] 获取键盘keyboard所占区域大小,调整界面布局
键盘大小变化时,系统会发出 UIKeyboardWillShowNotification 通知,我们只要监听这个通知,并在响应函数里处理界面布局就行。 [[NSNotificationCenter defaultCenter] addObserver:self selector:@sel原创 2013-05-01 23:33:05 · 725 阅读 · 0 评论 -
[iOS代码] iOS怎么平铺图片
UIImageView不支持图片平铺,通过设置颜色纹理,会有平铺效果。 UIImage* bgImage = [UIImage imageNamed:@"bg.png"]; [self.view setBackgroundColor:[UIColor colorWithPatternImage:bgImage]];原创 2013-05-01 10:59:23 · 605 阅读 · 0 评论