P1 · iOS中NSOperationQueue与GCD分派队列 我们已经知道iOS还提供了一种叫做NSOperationQueue的队列机制。就像分派队列一样,它也接受块作为参数并加入队列。你可能会问
P15 一个UI事件,Timer call, delegate call, 都会是一个新的Runloop iOS有没有垃圾回收? Objective-C 2.0也是有垃圾回收机制的,但是只能在Mac OS X Leopard
#import "ViewController.h" @interface ViewController () @property(nonatomic,strong)UITextView *textView; @property(nonatomic,copy)NSString *BASE_URL; @property(nonatomic,copy)NSString *BASE_URL1_PARAM
简单的音乐播放 导入AVFoundation.framework - (void)viewDidLoad { [super viewDidLoad]; //路径 NSString* path = [[NSBundle mainBundle] pathForResource:@"xiguan" ofType:@"mp3"]; //路径->url NSURL* url = [NSURL fileURL
首先要先导入第三方类库FMdatabase。 获得存放数据库文件的沙盒地址。 +(NSString*)databaseFilePath [objc] view plaincopy { NSArray*filePath=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES); NSString*doc
IOS中对JSON格式的解析通常可以采用NSJSONSerialization来实现. 如,我们可以用个简答的HTTP请求的方式获取JSON数据,(以下都是在playground中写的) var
处理图片颜色 - (UIImage*)grayscale:(UIImage*)anImage type:(int)type{ CGImageRef imageRef = anImage.CGImage; size_t width = CGImageGetWidth(imageRef); size_t height = CGImageGetHeight(imageRef); size_t bitsP
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. UIImageView *imageView = [[UIImageView alloc] init]; imageView.frame = CGRectMake(0, 0, 80, 120); imageVie
1.保存在user Document文件夹下,以读取文件,写入文件方式 2.在工程里手动创建一个.plist文件,把固定的内容写入,这个需要人工手动写入(工程里只可读取,不可以写入) 3.保存在user Document下,不过不需要读写文件,用系统的 NSUserDefaults 可以快速保存添加读取删除基本数据类型 这里记录的是第1种,第2种就是创建一个plist文件,然后自己手动写入数据,再
iOS下的具体实现方式如下 新建一个类 继承 #import
// // ViewController.m // LocationDemo // // Created by LaughingZhong on 14/11/12. // Copyright (c) 2014年 Laughing. All rights reserved. // #import "ViewController.h" @interface ViewController () @end
CLGeocoder *myGeocoder = [[CLGeocoder alloc] init]; [myGeocoder geocodeAddressString:_searchBar.text completionHandler:^(NSArray *placemarks, NSError *error) { if ([placemarks count] > 0 && error == n
[CTSIMSupportGetSIMStatus() isEqualToString:kCTSIMSupportSIMStatusNotInserted] 可以判断是否插入了sim卡。 需要CoreTelephony.framework。 /** * 检测是否有SIM卡 * [CTSIMSupportGetSIMStatus() isEqualToString:kCTSIMSupportSIMS
@interface UIButton (AsyncImage) //size by point - (void)setImageFromURL:(NSString *)urlString adjustToSize:(CGSize)size completion:(void (^)(void))completion logo:(UIImage *)logoImage; @end @implemen
+ (UIImage *) imageFromView: (UIView *) theView { // Draw a view’s contents into an image context UIGraphicsBeginImageContext(theView.frame.size); CGContextRef context = UIGraphicsGetCurrentContext();
Flash。 与此同时,Chrome for iOS 也升级到了新版, 继桌面版、Android 版之后,Chrome 26 for iOS 也正式发布了 ,iPad 和 iPhone 用户现在都可以更新至
常常将自己的产品称为艺术与科技的完美结合,至少在乔布斯时代是这样的说的。那么,艺术性对于 Apple 产品是一个重要的评判指标,首先 iOS7 在艺术上就是失败的。 为什么这样说呢?先讲一个故事: 加拿大有一座城市举行了一个艺术大
iPad 版本 iOS 7 还没有发布,不过泄露的截图和视频已经满天飞了。 俄罗斯一个名为 Rozetked 的 YouTube 用户日前发布了一则据称是 iPad 版本 iOS 7 操作系统视频
截至目前 iOS 7 已经出了 5 个测试版本了,其正式版到底会在何时跟大家见面呢? 今天早些时候,美国媒体 BGR 给出消息称,下周苹果会带来 iOS 7 Beta 6,而在这之后也就是 9 月
Android 和 iOS 的支持,增加对 Windows RT 的支持预览演示和一个全新的 Qt 移动编辑软件包。Qt 5.1 实现的是 Qt for Android 和 iOS 的支持预览演示。