iOS
__Jun__
积极、乐观、向上!
展开
-
2016年 iOS春节后证书无效
2016年,春节后上班,提示此证书签发者无效系统证书WWDR在2016年2月14日失效,需要更新WWDR系统证书下载证书地址并安装https://developer.apple.com/certificationauthority/AppleWWDRCA.cer1.在 “登陆” 里面删除过期的证书2.在 “系统” 里面删除过期的证书原创 2016-02-22 10:06:09 · 406 阅读 · 0 评论 -
iOS IBInspectable和IB_DESIGNABLE
转载网址: http://www.2cto.com/kf/201504/395034.html转载 2015-06-12 14:18:56 · 448 阅读 · 0 评论 -
iOS UIFont 初识
UIFont *font = [UIFont systemFontOfSize:32]; CGFloat pointSize = font.pointSize; CGFloat capHeight = font.capHeight; CGFloat xHeight = font.xHeight; CGFloat lineHeight = font.lineHe原创 2015-06-08 10:08:15 · 927 阅读 · 0 评论 -
dispatch API简单总结
// dispatch API- (void)dispatch_demo{ //生成Serial Dispatch Queue 时,传入NULL(DISPATCH_QUEUE_SERIAL) //Concurrent Dispatch Queue时,传入 DISPATCH_QUEUE_CONCURRENT dispatch_queue_t mySerialDispatc原创 2015-06-07 23:50:20 · 1052 阅读 · 0 评论 -
iOS AFNetworking下载文件
1. NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfi原创 2015-06-08 09:54:55 · 2370 阅读 · 0 评论 -
iOS 数值转换成string
int a = 10; [[NSNumber numberWithInt:10] stringValue]; //与下面方法等同 [@(a) stringValue];原创 2015-06-07 12:05:13 · 620 阅读 · 0 评论 -
阅读《Effective Objective-C 2.0 编写高质量iOS与OS X代码的52个有效方法》总结
第1条:了解Objective-C语言的起源Objective-C为C语言添加了面向对象特性,是其超集。Objective-C使用动态绑定的消息结构,也就是说,在运行时才会检查对象类型。接收一条消息之后,究竟应执行何种代码,由运行期环境而非编译器来决定。理解C语言的核心概念有助于写好Objective-C程序。尤其要掌握内存模型与指针。第2条:在类的头文件中尽量少引入其他头文件原创 2015-06-07 22:52:29 · 1635 阅读 · 0 评论 -
iOS UILocalizedIndexedCollation
UILocalizedIndexedCollation 是一个帮助我们组织列表数据的类,它能够根据地区来生成与之对应区域索引标题。不需要直接创建它的对象,我们可以通过 UILocalizedIndexedCollation +currentCollation 获得一个对应当前地区的单例对象。UILocalizedIndexedCollation 的首要任务就是决定对于当前地区区域索引标题应该是原创 2015-06-07 12:58:01 · 506 阅读 · 0 评论 -
iOS 项目修改工程名称
将iLearning 工程改名为iStudy,步骤如下:1.拷贝项目工程2.修改工程名点击“Rename”按钮,重命名3.修改Scheme4.修改文件夹名称5.修改工程配置文件原创 2015-06-19 14:49:53 · 376 阅读 · 0 评论 -
iOS UITableView系统自带下拉刷新
[self.refreshControl beginRefreshing]; [self.refreshControl endRefreshing];// 手动添加下拉刷新UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];[refreshControl addTarget:self action:@se原创 2015-04-28 23:54:09 · 1091 阅读 · 0 评论 -
iOS VLC github地址
MPMoviePlayerController并不支持所有的视频格式,如果要播放不支持的视频格式,需要借助第三方框架进行解码,如VLChttps://github.com/videolan/vlc原创 2015-05-08 00:11:14 · 1591 阅读 · 0 评论 -
iOS HTTP Range 使用
通过设置Range可以指定每次从网路下载数据包的大小Range示例bytes=0-499 从0到499的头500个字节bytes=500-999 从500到999的第二个500字节bytes=500- 从500字节以后的所有字节bytes=-500 最后500个字节bytes=500-599,800-899 同时指定几个范围- 用于分隔前面的数字表示起始字节原创 2015-05-08 00:35:25 · 2552 阅读 · 0 评论 -
iOS 将.m文件转成cpp文件
使用clang命令,将.m文件转换成.cpp文件clang -rewrite-objc main.m原创 2015-05-08 00:23:14 · 1593 阅读 · 0 评论 -
iOS Copy
//遵守Copying, MutableCopying协议@interface Person : NSObject @property (nonatomic, copy) NSString *name;@end@implementation Person//实现方法- (id)copyWithZone:(NSZone *)zone{ Person *p = [[[self原创 2015-05-07 23:16:48 · 364 阅读 · 0 评论 -
iOS 模型description写法
- (NSString *)description{ return [NSString stringWithFormat:@"", [[self class] description], self, @{ @"nickName" : self.nickName,原创 2015-04-28 00:42:32 · 991 阅读 · 0 评论 -
iOS 转盘效果
//转盘效果//开始- (void)startRotating{ if (self.link) return; // 1秒内刷新60次 CADisplayLink *link = [CADisplayLink displayLinkWithTarget:self selector:@selector(update)]; [link addToRun原创 2015-04-22 23:38:40 · 1479 阅读 · 0 评论 -
Mac 下配置SVN服务器
MAC已经自带了SVN1、创建repositorysvnadmin create /Users/Dream/SVNRepository2、配置svn(1)、配置svnserve.conf删除以下4行前面的#以多余的空格#anon-access = read#auth-access = write#password-db = passwd#authz-db原创 2015-07-20 11:29:53 · 291 阅读 · 0 评论 -
iOS UIDevice保存的信息
UIDevice *device = [UIDevice currentDevice]; NSLog(@"%@", device.name); //iPhone Simulator NSLog(@"%@", device.model); //iPhone Simulator NSLog(@"%@", device.localizedModel); //iPhone Simu原创 2015-07-20 11:16:26 · 410 阅读 · 0 评论 -
iOS 导航栏设置
// 取出appearance对象 UINavigationBar *navBar = [UINavigationBar appearance]; // 设置tintColor [navBar setTintColor:[UIColor blackColor]]; // 导航栏显示成clearColor UIImage *image =原创 2015-10-31 14:14:21 · 503 阅读 · 0 评论 -
swift enum 使用rawValue
1. 定义enum@objc public enum DMRootViewBottomItemType: Int32 { case Borrow = 0, Return, Buy, Near}2.定义变量let type = DMRootViewBottomItemType.Borrow3.取出rawValueitem.tag = Int(type原创 2015-11-11 10:39:49 · 4035 阅读 · 0 评论 -
swift 调用 setValuesForKeysWithDictionary 异常问题
1. 自定义类class UserItem: NSObject {var age: Int = 0var nickName: String?}2. 保存json数据将UserItem对象序列化生成字符串得到:"{\n \"age\" : 18,\n \"nickName\" : \"DM\",\n}将上面String保存至文件3.读取Stri原创 2015-11-10 14:35:19 · 1469 阅读 · 0 评论 -
iOS 中间显示透明圆
//背景色 [[UIColor grayColor] set]; CGContextAddRect(ctx, rect); CGContextFillPath(ctx); //设置为清空模式 CGContextSetBlendMode(ctx, kCGBlendModeClear); //画圆 CGContextAddEllipse原创 2015-06-13 01:36:08 · 976 阅读 · 0 评论 -
Xcode 不能打包iOS App Archive
不能打包 iOS App Archive,搜索得到答案: http://stackoverflow.com/questions/10715211/cannot-generate-ios-app-archive-in-xcode原创 2015-10-07 10:27:48 · 395 阅读 · 0 评论 -
objc_getAssociatedObject 出现异常
定义属性@property (nonatomic, assign) NSInteger unreadCount;使用运行时关联对象- (NSInteger)unreadCount { return [objc_getAssociatedObject(self, @selector(unreadCount)) intValue]; //运行至此处报错}- (void)set原创 2015-10-09 14:53:19 · 3027 阅读 · 0 评论 -
swift 中使用weak self
request.responseString(encoding: NSUTF8StringEncoding) {[weak self] (res) -> Void in if let strongSelf = self { //do something... }}weak var weakSelf = selfrequest.responseString(encod原创 2015-10-20 16:03:53 · 4418 阅读 · 0 评论 -
iOS 9 适配HTTP请求拒绝问题
iOS 9 需要使用HTTPS,如果需要继续使用http,则需要在info.plist文件中添加NSAppTransportSecurity 再添加 NSAllowsArbitraryLoads原创 2015-10-20 14:11:18 · 442 阅读 · 0 评论 -
swift 中使用代理
@objc protocol DMLoginViewDelegate { optional func loginViewDidClickLogin(loginView: DMLoginView)}class DMLoginView: UIView { weak var delegate: DMLoginViewDelegate? @IBAction func原创 2015-10-20 16:39:20 · 269 阅读 · 0 评论 -
iOS 8 使用CoreLocation定位配置
iOS 8 使用CoreLocation 需要在info.plist文件里配置:NSLocationAlwaysUsageDescriptionNSLocationWhenInUseUsageDescription以上两个字段,自定义提示用户授权使用地理定位功能时的提示语。原创 2015-10-20 14:28:23 · 338 阅读 · 0 评论 -
iOS下拨打电话
iOS下拨打电话- (void)callTelephone:(NSString *)telephone{ NSString *string = [NSString stringWithFormat:@"tel:%@", telephone]; if (nil == self.m_webView) { UIWebView *callWebview = [[UI原创 2015-08-19 10:39:55 · 357 阅读 · 0 评论 -
iOS View添加圆角
1. view四个边角添加圆角方法 self.m_headerImageView.layer.masksToBounds = YES; self.m_headerImageView.layer.cornerRadius = 10; self.m_headerImageView.layer.borderColor = [UIColor whiteColor].CGColor原创 2015-08-19 11:12:55 · 482 阅读 · 0 评论 -
iOS 获取Mac Address
- (NSString *)macAddress{ int temp[6]={0}; size_t len=0; char *buf=NULL; unsigned char *laddr=NULL; struct if_msghdr *ifmsghdr=NULL; struct sockaddr_dl *sockaddr=NULL;原创 2015-07-20 11:12:55 · 564 阅读 · 0 评论 -
iOS企业帐号对ipa重新签名流程
将ipa应用重新签名流程如下:1.企业开发$299美金帐户2.登录https://developer.apple.com3.创建certificates证书,并安装. 通过钥匙串得到证书名称:"iPhone Distribution:xxxxxx,Inc."4.创建Distribution, In House 的 provisioning。并下载下来命名为inh原创 2015-07-21 14:07:56 · 7460 阅读 · 0 评论 -
iOS MPMoviePlayerController 使用
@interface MoviePlayerViewController ()@property (nonatomic, strong) MPMoviePlayerController *moviePlayer;@end@implementation MoviePlayerViewController- (MPMoviePlayerController *)moviePlayer{原创 2015-05-08 00:01:57 · 686 阅读 · 0 评论 -
iOS va_list可变参数使用
// NS_REQUIRES_NIL_TERMINATION, 自动加上nil+ (instancetype)itemIdentiferWithIden:(id)identifier, ... NS_REQUIRES_NIL_TERMINATION;va_list args;va_start(args, identifier);while (TRUE){ id obj = va_a原创 2015-05-20 10:40:18 · 664 阅读 · 0 评论 -
iOS NSURLSesstion 上传
// NSURLSesstion 上传- (void)uploadFile{ // 1. NSURL NSString *urlString = @"http://localhost/uploads/test.png"; urlString = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8Stri原创 2015-05-09 00:49:48 · 462 阅读 · 0 评论 -
iOS block 总结
^是Block的特有标记Block的实现代码包含在{}之间大多情况下,以内联inline函数的方式被定义和使用例如:void(^demoBlock)() = ^ { NSLog(@"demo Block");};int(^sumBlock)(int, int) = ^(int x, int y) { return x + y;};格式说明:(返原创 2015-04-23 00:07:00 · 391 阅读 · 0 评论 -
iOS 导航栏自定义返回按钮
方法一:// 缺陷是图片显示成纯色的// 设置全局导航栏返回按钮指示图UINavigationBar *navBar = [UINavigationBar appearance];UIImage *image = [UIImage imageNamed:@"back"];//以下两个必须同时设置navBar.backIndicatorImage = image;navBar.back原创 2015-05-08 10:32:57 · 665 阅读 · 0 评论 -
iOS UISlider
UISlider* slider = [[UISlider alloc] initWithFrame:CGRectMake(20, 400, 280, 30)];//最小值slider.minimumValue = 100;//最大值slider.maximumValue = 300;//当前值slider.value = 100;//事件[slider addTarget:sel原创 2015-04-26 22:46:13 · 372 阅读 · 0 评论 -
UIImageView 使用
//要播放的图片UIImage添加到一个NSArray里面 NSMutableArray* array = [NSMutableArray array]; for (int i = 1; i < 9; i++) { UIImage* image = [UIImage imageNamed:[NSString stringWithFormat:@"%02d.png",原创 2015-04-17 01:12:52 · 370 阅读 · 0 评论 -
iOS 锁的总结
//互斥锁NSLock *_lock;_lock = [[NSLock alloc] init];while (1){ [_lock lock]; //相关操作... [_lock unlock];}//条件锁 NSCondition *_condition;_condition = [[NSCondition alloc] ini原创 2015-04-26 20:44:06 · 338 阅读 · 0 评论