今天在重写父类的init方法时报错如下: error:Cannot assign to 'self' outside of a method in the init family 这种问题以前从来没有遇到过呀...当然以前我也从来重写过父类的init方法啦...嘿嘿.... 最后发现问题如下: 只能在init方法中给self赋值,Xcode判断是否为init方法规则:方法返回id,并且名字以init +大写字母开头+其他  为准则.例如:- (id) initWithXXX; 不注意将init后…
有时候我们重写父类的init方法时不注意将init后面的第一个字母写成了小写,在这个方法里面又调用父类的初始化方法(self = [super init];)时会报错,错误信息如下:error:Cannot assign to 'self' outside of a method in the init family 原因:只能在init方法中给self赋值,Xcode判断是否为init方法规则:方法返回id,并且名字以init +大写字母开头+其他  为准则.例如:- (id) initWit…
#import <Foundation/Foundation.h> @interface EOCRectangle : NSObject<NSCoding> @property (nonatomic , readonly , assign) float width; @property (nonatomic , readonly , assign) float height; -(id)initWithWidth:(float) width andHeight:(float) he…
有时候我们重写父类的init方法时不注意将init后面的第一个字母写成了小写,在这个方法里面又调用父类的初始化方法(self = [super init];)时会报错,错误信息如下:error:Cannot assign to 'self' outside of a method in the init family 原因:只能在init方法中给self赋值,Xcode判断是否为init方法规则:方法返回id,并且名字以init+大写字母开头+其他  为准则.例如:- (id) initWith…
有时候我们重写父类的init方法时不注意将init后面的第一个字母写成了小写.在这种方法里面又调用父类的初始化方法(self = [super init];)时会报错,错误信息例如以下:error:Cannot assign to 'self' outside of a method in the init family 原因:仅仅能在init方法中给self赋值.Xcode推断是否为init方法规则:方法返回id.而且名字以init+大写字母开头+其它  为准则.比如:- (id) initW…
1.error: macro names must be identifiers YourProject_prefix.pch 原因: 因为你弄脏了预处理器宏,在它处于<Multiple Values>的时候修改了它 解决方法: Configiration选择All Configirations,清空它 然后分别重新定义你的Debug,Release,Distributin预处理器宏吧 2.warning: no rule to process file '$(PROJECT_DIR)/Loa…
1.error: macro names must be identifiers YourProject_prefix.pch 原因: 因为你弄脏了预处理器宏,在它处于<Multiple Values>的时候修改了它 解决方法: Configiration选择All Configirations,清空它 然后分别重新定义你的Debug,Release,Distributin预处理器宏吧 2.warning: no rule to process file '$(PROJECT_DIR)/Loa…
1.error: macro names must be identifiers YourProject_prefix.pch 原因: 因为你弄脏了预处理器宏,在它处于<Multiple Values>的时候修改了它 解决方法: Configiration选择All Configirations,清空它 然后分别重新定义你的Debug,Release,Distributin预处理器宏吧 2.warning: no rule to process file '$(PROJECT_DIR)/Loa…
1.Method definition for 'xxx' not found xxx的方法没有实现 出现原因.h声明了xxx方法但是.m没有实现xxx方法 解决方法:在类的.m文件实现xxx方法   2. Instance variable ‘xxx' accessed in class method   在类方法中访问了'xxx’实例变量 出现原因:在类方法中使用了实例变量 解决方法:如果真得需要在类方法中使用某个变量,可以把这个变量定义成全局变量,而不要实例变量,如在类方法外面定义变量(就…
在开发的过程中难免会遇到很多的错误,可是当看到系统给出的英文时,又不知道是什么意思.所以这篇文章总结了Xcode中常见的一些英文单词及词组,可以帮助初学的人快速了解给出的提示.多练习,就肯定能基本掌握. expression:表达式 assignable:赋值variable:变量+redefinition:重复定义type:类型conflicting:冲突项invalid:无效的conversion:转换specifier:说明符indent:缩进operands:运算对象.操作数binary…
1.error: macro names must be identifiers YourProject_prefix.pch 原因: 因为你弄脏了预处理器宏,在它处于<Multiple Values>的时候修改了它 解决方法: Configiration选择All Configirations,清空它 然后分别重新定义你的Debug,Release,Distributin预处理器宏吧 2.warning: no rule to process file '$(PROJECT_DIR)/Loa…
1.error: macro names must be identifiers YourProject_prefix.pch 原因: 因为你弄脏了预处理器宏,在它处于<Multiple Values>的时候修改了它 解决方法: Configiration选择All Configirations,清空它 然后分别重新定义你的Debug,Release,Distributin预处理器宏吧 2.warning: no rule to process file '$(PROJECT_DIR)/Loa…
今天在本地搭建一个测试用的最新版ElasticSearch6.4.3 的环境时,遇到一个报: [Cannot assign requested address: bind]的错误. 错误日志内容如下: H:\ElasticSearch\6.4.3\elasticsearch-6.4.3-node1\bin>H:\ElasticSearch\6.4.3\elasticsearch-6.4.3-node1\bin\el asticsearch.bat [2018-11-12T15:15:40,305…
这里列举的是一些我平时碰到的一些Java Grammar,日积月累. Class Variable vs Instance Variable: Instance variables Instance variable is the variable declared inside a class, but outside a method Instance variables belong to an instance of a class. Another way of saying that…
package myservlet.control; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import…
前言 ControllerAdvice非常好用,可以把系统内部的异常统一处理.用起来也很简单.比如,http://www.cnblogs.com/woshimrf/p/spring-web-400.html 而Spring提供了一个base类ResponseEntityExceptionHandler,可以使用这个来处理.但用的时候要注意,不要重复定义异常捕获,对于base里已经定义好的,只要overwrite就好,不要重复声明异常拦截. 以下来自stackoverflow 问题 @Contro…
设计思路:给UIView增加一个分类 所有的视图都可以根据需要来进行红点显示 #import <UIKit/UIKit.h> @interface UIView (CHRRedDot) @property (readonly, nonatomic) CALayer * chr_redDotLayer; /** 红点圆心的位置,与各个边之间的距离.如果距离<=0,则忽略距离 */ @property (nonatomic, assign) UIEdgeInsets chr_redDotEd…
单体是一个用来划分命名空间并将一些相关的属性与方法组织在一起的对象,如果她可以被实例化的话,那她只能被实例化一次(她只能嫁一次,不能二婚). 单体模式是javascript里面最基本但也是最有用的模式之一. 特点:1. 可以用来划分命名空间,从而清除全局变量所带来的危险或影响. 2. 利用分支技术来来封装浏览器之间的差异.   3. 可以把代码组织的更为一体,便于阅读和维护. 单体模式的基本写法: /* 最基本的单体模式 */ var her = { name: 'Anna', sex: 'wo…
      本文由海水的味道编译整理,转载请注明译者和出处,请勿用于商业用途! 点标记语法 属性和幂等方法(多次调用和一次调用返回的结果相同)使用点标记语法访问,其他的情况使用方括号标记语法. 良好的风格: view.backgroundColor = [UIColor orangeColor]; [UIApplication sharedApplication].delegate; 不良的风格: [view setBackgroundColor:[UIColor orangeColor]];…
fetch('https://mywebsite.com/endpoint/', { method: 'POST',headers: {'Accept': 'application/json','Content-Type': 'application/json',},body: JSON.stringify({username: 'yourValue',pass: 'yourOtherValue',})}).then((response) => response.json()).then((re…
fetch('https://mywebsite.com/endpoint/', { method: 'POST',headers: {'Accept': 'application/json','Content-Type': 'application/json',},body: JSON.stringify({username: 'yourValue',pass: 'yourOtherValue',})}).then((response) => response.json()).then((re…
Oftentimes you’ll find yourself using classes you can’t modify. Whether they’re basic data types or part of an existing framework, you’re stuck with the functions that are provided. That being said, C# provides a nifty trick to appending functions to…
iOS夯实:内存管理 文章转自 内存管理 最近的学习计划是将iOS的机制原理好好重新打磨学习一下,总结和加入自己的思考. 有不正确的地方,多多指正. 目录: 基本信息 旧时代的细节 新时代 基本信息 Objective-C 提供了两种内存管理方式. MRR (manual retain-release) 手动内存管理这是基于reference counting实现的,由NSObject与runtime environment共同工作实现. ARC (Automatic Reference Cou…
一,前言 Objective-C 中的键(key)-值(value)观察(KVO)并不是什么新鲜事物,它来源于设计模式中的观察者模式,其基本思想就是: 一个目标对象管理所有依赖于它的观察者对象,并在它自身的状态改变时主动通知观察者对象.这个主动通知通常是通过调用各观察者对象所提供的接口方法来实现的.观察者模式较完美地将目标对象与观察者对象解耦. 在 Objective-C 中有两种使用键值观察的方式:手动或自动,此外还支持注册依赖键(即一个键依赖于其他键,其他键的变化也会作用到该键).下面将一一…
Verilog Interiew Quetions Collection :  What is the difference between $display and $monitor and $write and $strobe? What is the difference between code-compiled simulator and normal simulator? What is the difference between wire and reg? What is the…
flex 访问WebService的方法有很多种,使用FLEX4中的"数据/服务"功能可以自动生成访问WebService的代理类,这样可以避免把所有的数据访问都写到MXML页面上,便于重复利用,同时可以直接导入后台自定义数据类型,方便传参. 直接上代码:其中WebService接口 namespace MyNetWebService { /// <summary> /// MyWebService 的摘要说明 /// </summary> [WebServic…
类型成员 Type Member 结构体 struct 的成员很简单,只有变量. 类的成员就很多了: 数据成员 data member 描述对象(本讲重点) · 实例变量  instance variable · 属性 property 函数成员 function member · 方法 method · 初始化器  init · 析构器  dealloc 类的属性: 默认情况下,编译器会为属性定义propertyName自动合成: 一个getter访问器方法: propertyName 一个s…
总结1.modifier 改性剂 修饰符 修饰语 调节器access modifier 访问修饰符 存取权限 存取修饰词 存取修饰字官网“can”Access level modifiers determine whether other classes can use a particular field or invoke a particular method. There are two levels of access control:是否允许2.2个方面类的存取修饰词方法的存取修饰词…
Vue 组件设计 Vue 作为 MVVM 框架一员,不管是写业务还是基础服务,都少不了书写组件.本文总结一下书写业务组件的一些心得. 为什么要写组件? 我们知道,只要是组件,就需要在引用的时候与 view 或者其他组件进行相关的交互,即 props 传值,$emit 触发事件, 使用 $refs 调用组件方法等,与写在同一个文件相比,耗费的精力明显更多.那为什么需要拆分出组件呢?我认为有两种目的: 复用和隔离. 复用 在业务代码中,会有大量类似的界面,保证交互唯一,即使我们有了类似 elemen…
Chapter 4. The class File Format Table of Contents 4.1. The ClassFile Structure 4.2. Names 4.2.1. Binary Class and Interface Names 4.2.2. Unqualified Names 4.2.3. Module and Package Names 4.3. Descriptors 4.3.1. Grammar Notation 4.3.2. Field Descript…