AppleScript入门
摘要:编辑器:AppleScript Editor这位仁兄写的入门文章还不错:http://bukkake.iteye.com/blog/828322,就不重复了。下面补充一点别的AppleScript的后缀名为.scpt,可以将编写好的.scpt导出为几种格式:.applescript(Text), .app(Application), .scptd(script bundle),都有什么用呢?.scptd(script bundle):像Mac上其他的bundle一样,是一个压缩包,包含scpt文件和其他的声音、图片等资源。双击后打开AppleScript Editor.app(Applicat
阅读全文
iOS开发之理解Certificate、AppId和Provisioning Profile
摘要:Certificates证书是你有权利开发的凭证,是开发者的一种标识,相当于身份证,一个开发者账号只有一套。一套含两个,Development和Distribution。其中Development证书提供开发者在电脑上真机调试的权限,可以制作多个副本分发到多台电脑。Distribution证书给开发者提供发布ios程序的权限,也就是说有了这个,你就有权力发布程序到App Store去了,当然这只是万里长征的第一步。只有一个,不能制作副本分发到多台电脑。Devices个人认为ios和android在开发上最大的区别,安卓系统默认就开放了真机开发调试,任何人任何一台机器,不需要任何认证,即可以在真
阅读全文
使用Terminal
摘要:在Mac中Terminal是使用bash的,下面列一列bash中常用的快捷键,可以提高工作效率哦:CRTL + W: 删除光标所在位置左边的第一个word,并且光标所在的字符不会被删掉;CRTL + R : 搜索命令历史ESC + DEL: 删除光标所在位置左边的第一个word或者空格OPTION+LEFT: 向左移动一个wordOPTION+RIGHT: 向右移动一个word下面有个更全的,需要什么的时候再慢慢查吧
阅读全文
关于Xcode
摘要:本文在Xcode4.6基础上介绍的,不一定适用其他版本的Xcode。关于DWARF与dSYMDWARF is a debugging file format used by many compilers and debuggers to support source level debugging. It addresses the requirements of a number of procedural languages, such as C, C++, and Fortran, and is designed to be extensible to other languages.
阅读全文
使用grep
摘要:1. 如何让grep高亮显示搜索的字串.GREP_OPTIONS高亮显示搜索的字串 通过修改GREP_OPTIONS对搜索字串高亮显示。 $ export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32'关于GREP_OPTIONS:color有三个值供选择:never、always、auto。
always 和auto的区别就是,always会在任何情况下都给匹配字段加上颜色标记, 而auto则只在输出到终端时才加上颜色。
可以在.bashrc/.bash_profile 里加上
export GREP_OPTIONS
阅读全文
About Common Crypto
摘要:The Common Crypto library, also known as CCCrypt and 3CC, provide access to anumber of types and flavors of encryption algorithms. The Common Crypto library offunctions supports AES, DES, 3DES, and other encryption standards. Depending onthe encryption algorithm used, block and/or stream ciphers are
阅读全文
Delegate in Cocoa
摘要:Delegate模式并没有标准定义,也没有标准行为,所以在不同的地方使用的方式也不一样,C#中Delegate就是一个方法,而Cocoa中Delegate是一个对象(或者说adopt了某个protocol的对象),下面的一句话描述还比较贴切:A delegate is an object that’s given an opportunity to react to changes in another objector influence the behavior of another object.It stores a reference to another object, its d
阅读全文
Outlets, Target and Action
摘要:Target-action is a design pattern in which an object holds the information necessary to send a message to another object when an event occurs. The stored information consists of two items of data: an action selector, which identifies the method to be invoked, and a target, which is the object to rec
阅读全文
UI Elements in Cocoa
摘要:DialogDialog是application modal的,意味着如果没有结束这个Dialog,那用户将无法对这个application做任何操作。SheetsSheets是document modal的,意味着如果没有结束这个sheet,那用户将无法对这个Document或者这个window进行任何操作。什么是啥使用Sheets:需要一个针对某个document的特定dialog时,比如saving, printing。Cocoa的NSSavePanel和NSPrintPanel将其自身present为sheets。某个不创建document的单窗口应用需要一个dialog时,一个单窗口
阅读全文
Placeholder Objects(File’s Owner,First Responder,Application)
摘要:There are two kinds of objects displayed in the Interface Builder dock: Interface objects and placeholder objects. Interface objects are the objects that are actually created when the nib file is loaded and typically comprise the bulk of the objects. Placeholder objects refer to files that live outs
阅读全文
Cocoa.Programming.for.Mac.OS.X 3rd 前8章小知识点
摘要:最近看了《Cocoa.Programming.for.Mac.OS.X 3rd》前八章,虽然第一遍的时候,可以很容易按照书中的介绍把例子程序正确的运行起来,但是并不知道为啥那样写代码就work了。对于一些隐藏的知识点,不便作为单独的文章来介绍,本文收集这些知识,介绍如下。1.NSUserInterfaceItemIdentification ProtocolThe NSUserInterfaceItemIdentification protocol is used to associate a unique identifier with objects in your user interf
阅读全文
Object copying
摘要:NSObject类定义了copy方法,但这只是一个convinence method for classes who adopt NSCopying协议。如果某个类没有实现copyWithZone:,那调用copy方法会抛出异常。NSObject类的方法mutableCopy对应于NSMutableCopying protocol的方法mutableCopyWithZone:NSObject does not itself support the NSCopying protocol. Subclasses must support the protocol and implement the
阅读全文
关于 XIB 和 NIB
摘要:NIB 和 XIB 的区别与联系NIB 和 XIB 都是 Interface Builder 的图形界面设计文档。引用《Cocoa Programming for Mac OSX》一书的说法,Interface Builder 把窗口、菜单栏以及窗口上的各种控件的对象都“冻结”在了一个 NIB文档里面了;程序运行时,这些对象将会“苏醒”。在终端下我们可以看到,NIB 其实是一个目录。它里面有两个也是后缀为 NIB 的文件:designable.nib 和 keyedobjects.nib。前者是一个 XML 文档,而后者则是一个二进制文件。Interface Builder 3 之后,引入了新
阅读全文
Key-Value Observing
摘要:KVO和KVC在Cocoa中往往联合使用,是很好的工具。在之前的文章中我们介绍了KVC,这里要介绍一下KVO了。Key-value observing provides a mechanism that allows objects to be notified of changes to specific properties of other objects. It is particularly useful for communication between model and controller layers in an application. (In OS X, the con
阅读全文
Key-Value Coding Accessor 及其与KVC的关系
摘要:我们知道KVC时,当valueForKey:和setValue:forKey:被调用时,对应key的accessor method会被调用,这里我们介绍Key-Value Coding Accessor,通过此文,我们应该对KVC和Accessor的关系会更清楚。之前我们也介绍过类的ivars与owning object共有4种关系:attribute, to-one relationship , ordered to-many relationship, unordered to-many relationship, 介绍Accessor也要根据这4中关系介绍。Basic Accessor
阅读全文
使用Key-Value Coding
摘要:之前的一篇文章介绍了实现Key-Value Coding的5种方法,但用的最多的还是基于NSKeyValueCoding协议的。本文介绍的都是基于这个前提的。key是啥?A key is a string that identifies a specific property of an object. Typically, a key corresponds to the name of anaccessor method or instance variable in the receiving object. Keys must use ASCII encoding, begin wit
阅读全文
实现Key-Value Coding 的5种方法
摘要:简介Key-Value Coding(以后都简称为KVC),是一种设计模式,其想法就是不用对对象的某个属性进行设置或者读取,而是使用key来访问。这种模式在Map中是很容易理解的,因为Map/Dictionary中保存的就是key-value 对,对这个pair进行操作,都是通过key来操作的。KVC就不仅仅限于Map/Dictionary,而是把它扩展到了普通对象。任何不同对象的instance variable都可以用KVC。使用KVC的好处就是可以将变量本身与他要关联的属性进行解耦,比如有个值,代表下载进度,进度一方面要在UI的进度条上显示出来,一方面用数字的方式显示在另一个地方(Con
阅读全文
Objective-C protocol 和 delegate
摘要:概述protocol类似C++中的抽象类和Java中的interface。分为Formal protocol和informal protocol两种,其中在Objective C 2.0之前,informal protocol是Cocoa中实现delegate的重要基础。因为Objective C 2.0引入了@optional和@required关键字。delegate是一种常用的设计模式,而不是Objective C或者Cocoa的feature,也没有任何关键字是给delegate用的。protocolFormal protocol 声明了一个客户类需要实现的方法列表,它有自己独立的de
阅读全文
Objective-C 中的 self 和 super
摘要:在 Objective-C 中的类实现中经常看到这两个关键字 ”self” 和 ”super”,以以前 oop 语言的经验,拿 c++ 为例,self 相当于 this,super 相当于调用父类的方法,这么看起来是很容易理解的。以下面的代码为例:@interface Person:NSObject { NSString* name;}- (void) setName:(NSString*) yourName;@end@interface PersonMe:Person { NSUInteger age;}- (void) setAge:(NSUInteger) age;- (v...
阅读全文
Objective-C 拾遗
摘要:关于Method这里引入method specification的概念(我自己弄的,因为不了解官方的名称是什么,如果有人知道,请告诉我)。在C中,一个函数的方法名(区分大小写),也就是说,如果两个函数的方法名相同,即使参数个数或者参数类型不同,那么也认为这两个方法是一样的,从而产生错误(在C语言中是编译时错误),比如下面的代码:void foo() //valid{}int foo() //Error 1 error C2371: 'foo' : redefinition; different basic types{}void Foo() //valid{}void foo(
阅读全文