摘要: 子类可以为继承来的实例方法(instance method),类方法(class method),实例属性(instance property),或附属脚本(subscript)提供自己定制的实现(implementation)。我们把这种行为叫重写(overriding)。如果要重写某个特性,你需 阅读全文
posted @ 2016-08-26 16:23 J-Vijay 阅读(2268) 评论(0) 推荐(0)
摘要: 前提:Swift中有规定:对象中的任何属性在创建时,都必须要有明确的初始化值 1.定义可选类型 方式一:常规方式(不常用) var name : Optional<String> = nil 方式二:语法糖(常用) var name:String? = nil Optional理解: Optiona 阅读全文
posted @ 2016-08-26 15:33 J-Vijay 阅读(424) 评论(0) 推荐(0)
摘要: OC中使用: NSArray * lists = [NSArray array]; [lists enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { }]; Swift中使用: f 阅读全文
posted @ 2016-08-26 14:19 J-Vijay 阅读(351) 评论(0) 推荐(0)
摘要: 其实看完上面的叙述,你会思考,到底什么情况下,一个UIView需要只设置坐标不设置大小呢?其实这种场景相当普遍。比如,我们常常会碰到,一个View中有两个Label,两个Label的高度均和内容有关,这时候,你的View的高度就必须由两个Label的高度有关,而不能一开始就定死。例如。一个已知宽度的 阅读全文
posted @ 2016-08-26 10:50 J-Vijay 阅读(3185) 评论(0) 推荐(0)
摘要: 1.简介 NSOperation实例封装了需要执行的操作和执行操作所需的数据,并且能够以并发或非并发的方式执行这个操作。 NSOperation本身是抽象基类,因此必须使用它的子类,使用NSOperation子类的方式有2种: 1> Foundation框架提供了两个具体子类直接供我们使用:NSIn 阅读全文
posted @ 2016-08-26 10:06 J-Vijay 阅读(140) 评论(0) 推荐(0)
摘要: 1、简介: 1.1 iOS有三种多线程编程的技术,分别是: 1.、NSThread 2、Cocoa NSOperation (iOS多线程编程之NSOperation和NSOperationQueue的使用) 3、GCD 全称:Grand Central Dispatch( iOS多线程编程之Gra 阅读全文
posted @ 2016-08-26 10:05 J-Vijay 阅读(398) 评论(0) 推荐(0)
摘要: - (void)viewDidLoad { [super viewDidLoad]; // gcd 可以充分调用设备的 cpu 发挥最大性能,在 C 语言基础之上封装的 // dispatch_queue_t开辟一个线程 // DISPATCH_QUEUE_PRIORITY_DEFAULT设置优先级 dispatch_queue_t... 阅读全文
posted @ 2016-08-26 10:04 J-Vijay 阅读(296) 评论(0) 推荐(0)
摘要: /* 本地通知:不通过网络,在本地实现的通知,自己发给自己 远程通知:必须通过网络,使用推送技术(APNs),实现通知 本地通知: 1.要完成可以接收的通知形式的注册 2.具体通知的设置 3.发送通知 */ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NS... 阅读全文
posted @ 2016-08-26 10:02 J-Vijay 阅读(175) 评论(0) 推荐(0)
摘要: 指定定义的key的类型 <optional>表示字段可选,例如 //链接字段是可选的,转换的时候允许link未空 @property (nonatomic,strong) NSString</optional><optional> *link; <index>表示索引,参照1 <convertond 阅读全文
posted @ 2016-08-26 09:59 J-Vijay 阅读(367) 评论(0) 推荐(0)
摘要: [self.mapView deselectAnnotation:view.annotation animated:YES]; 阅读全文
posted @ 2016-08-26 09:58 J-Vijay 阅读(549) 评论(0) 推荐(0)
摘要: for (UIViewController *VC in self.navigationController.viewControllers) { if ([VC isKindOfClass:[CarInfoViewController class]]) { [self.navigationController popToViewC... 阅读全文
posted @ 2016-08-26 09:57 J-Vijay 阅读(342) 评论(0) 推荐(0)
摘要: -(id)initWithDic:(NSDictionary *)dic { if (self = [super init]) { [self setValuesForKeysWithDictionary:dic]; } return self; } -(void)setValue:(id)valu 阅读全文
posted @ 2016-08-26 09:55 J-Vijay 阅读(1032) 评论(0) 推荐(0)
摘要: NSString *strJTGZ = [NSString stringWithFormat:@"交通管制%d处 ",[jtgz intValue]]; NSMutableAttributedString *attributedStr = [[NSMutableAttributedString alloc]initWithString:strJTGZ]; [attribu... 阅读全文
posted @ 2016-08-26 09:53 J-Vijay 阅读(4163) 评论(0) 推荐(0)
摘要: -(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { // 首先判断otherGestureRecognizer是... 阅读全文
posted @ 2016-08-26 09:50 J-Vijay 阅读(3074) 评论(0) 推荐(0)
摘要: CATransition *transition = [CATransition animation]; transition.duration = 1.0f; transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; ... 阅读全文
posted @ 2016-08-26 09:49 J-Vijay 阅读(93) 评论(0) 推荐(0)
摘要: 最近看了看CoreGraphics的东西,看到关于CGColor的东西,于是就想着顺便看看UIColor,CIColor,弄清楚它们之间的区别和联系。下面我们分别看看它们三个的概念: 一、UIColor UIColor是UIKit中存储颜色信息的一个重要的类,一个UIColor对象包含了颜色和透明度 阅读全文
posted @ 2016-08-26 09:44 J-Vijay 阅读(207) 评论(0) 推荐(0)
摘要: JSPatch,只需在项目中引入极小的引擎,就可以使用JavaScript调用任何Objective-C的原生接口,获得脚本语言的能力:动态更新APP,替换项目原生代码修复bug。 是否有过这样的经历:新版本上线后发现有个严重的bug,可能会导致crash率激增,可能会使网络请求无法发出,这时能做的 阅读全文
posted @ 2016-08-26 09:27 J-Vijay 阅读(544) 评论(0) 推荐(0)