随笔分类 -  Mac/iOS

 
The Layout Process on Mac OSX and iOS
摘要:First we will recap the steps it takes to bring views on screen with Auto Layout enabled. When you’re struggling to produce the kind of layout you wan... 阅读全文
posted @ 2014-07-07 13:05 做个不善的人 阅读(885) 评论(0) 推荐(1)
Notes of learning AutoLayout
摘要:在XCode5中,如果我们添加一个Button或者Label,或者其他的什么标准View,而不设置任何constraints,IB会自动生成constraints,而这些constraints是fixed,无法根据intrinsic content size的变化而变化,这并不是我们想要的。比如,我... 阅读全文
posted @ 2014-07-06 01:54 做个不善的人 阅读(2844) 评论(0) 推荐(1)
对比学习UIKit和AppKit -- ViewController
摘要:在iOS中ViewController的基类是UIViewController;Mac中ViewController的基类是NSViewController。Mac中ViewController父类是NSViewController,子类很少,笔者就查到了NSPageController。如果应用中... 阅读全文
posted @ 2014-05-05 07:25 做个不善的人 阅读(4293) 评论(1) 推荐(1)
对比学习UIKit和AppKit--入门级
摘要:UIKit是用来开发iOS的应用的,AppKit是用来开发Mac应用的,在使用过程中他们很相似,可是又有很多不同之处,通过对比分析它们的几个核心对象,可以避免混淆。UIKit和AppKit都有一个Application类,每个应用都只创建一个Application对象,分别是UIAplication... 阅读全文
posted @ 2014-05-04 12:38 做个不善的人 阅读(5596) 评论(0) 推荐(1)
UIViewController
摘要:UIViewController 在MVC模式中就是C。关于MVC,可以看 UIViewController 主要具有什么功能呢? View Management When you define a new subclass of UIViewController, you must specify the views to be managed by the controller. A typ... 阅读全文
posted @ 2014-04-27 08:28 做个不善的人 阅读(3446) 评论(0) 推荐(0)
理解NSTypesetter 和 NSATSTypesetter
摘要:先说通常意义上的typeset(排字、排版),然后再说NSTypesetter 和 NSATSTypesetter,最后是它们的区别。Typesetting is the composition of text by means of types.这里的type是什么意思呢?In typesetting by hand compositing, a sort or type is a piece of type representing a particular letter or symbol, cast from a matrix mould and assembled with othe 阅读全文
posted @ 2013-12-28 09:37 做个不善的人 阅读(597) 评论(0) 推荐(0)
理解NSTextContainer
摘要:Apple的Doc对这个类的描述是这样的:The NSTextContainer class defines a region where text is laid out. An NSLayoutManager uses NSTextContainer to determine where to break lines, lay out portions of text, and so on. NSTextContainer defines rectangular regions, but you can create subclasses that define regions of ot 阅读全文
posted @ 2013-12-28 03:19 做个不善的人 阅读(7194) 评论(0) 推荐(0)
理解NSAttributedString
摘要:An NSAttributedString object manages character strings and associated sets of attributes (for example, font and kerning) that apply to individual characters or ranges of characters in the string.这句话就是对这个类的一个最简明扼要的概括。NSAttributedString管理一个字符串,以及与该字符串中的单个字符或某些范围的字符串相关的属性。比如这个字符串“我爱北京天安门”,“我”跟其他字符的颜色不一 阅读全文
posted @ 2013-12-27 09:06 做个不善的人 阅读(23198) 评论(0) 推荐(3)
Cocoa Drawing
摘要:Graphics ContextsGraphics contexts are a fundamental part of the drawing infrastructure in Cocoa applications. As the name suggests, a graphics context provides the context for subsequent drawing operations. It identifies the current drawing destination (screen, printer, file, and so on), the coordi 阅读全文
posted @ 2013-12-26 08:39 做个不善的人 阅读(955) 评论(0) 推荐(0)
AutoReleasePool 和 ARC 以及Garbage Collection
摘要:AutoReleasePoolautoreleasepool并不是总是被auto 创建,然后自动维护应用创建的对象。自动创建的情况如下:1. 使用NSThread的detachNewThreadSelector:toTarget:withObject:方法创建新线程时,新线程自动带有autoreleasepool。2. Main thread of Cocoa Application以下情况需要开发者创建:1. 在使用Dispatch Queue时, 虽然其Pool中每个thread都会有autoreleasepool,但是如果我们给的task每个都创建一些对象,并做autorelease,那 阅读全文
posted @ 2013-12-25 06:58 做个不善的人 阅读(5496) 评论(0) 推荐(0)
About View
摘要:View GeometryFrame & BoundsGraphically, a view can be regarded as a framed canvas. The frame locates the view in its superview, defines its size, and clips drawing to its edges, while the canvas hosts the actual drawing. The frame can be moved, resized, and rotated in the superview and the view& 阅读全文
posted @ 2013-11-18 13:00 做个不善的人 阅读(245) 评论(0) 推荐(0)
理解Mach Port
摘要:参考文档:1.http://robert.sesek.com/thoughts/2012/1/debugging_mach_ports.html2.Mach 3 Kernel Interfaces3.http://www.foldr.org/~michaelw/log/computers/macosx/task-info-fun-with-mach3.Mach3 Kernel Principles4.http://docs.huihoo.com/darwin/kernel-programming-guide/boundaries/chapter_14_section_4.html5.http: 阅读全文
posted @ 2013-11-15 13:32 做个不善的人 阅读(2761) 评论(0) 推荐(0)
理解Mac和iOS中的 Event 处理
摘要:根据现在的理解,我把event处理分为5部分,第一是,Event处理的Architecture;第二是,Event的Dispatch到first responder之前; 第三是,Event从first responder出来后;第四是,Action与Event的关系;第五是,Apple Event的处理。1. Event Handling Architecture下面这张图解释了在MacOSX上event处理的过程。Before it dispatches an event to an application, the window server processes it in variou 阅读全文
posted @ 2013-11-04 02:32 做个不善的人 阅读(1846) 评论(0) 推荐(0)
UIControlEvents 中各种event被触发的方式解释(zz)
摘要:转自:http://blog.csdn.net/yanxiaoqing/article/details/7108891在控件事件中,简单解释下下面几个事件。说明:由于是在“iOS 模拟器”中测试的,所以不能用手指,只能用鼠标。1)UIControlEventTouchDown指鼠标左键按下(注:只是“按下”)的动作2)UIControlEventTouchDownRepeat指鼠标左键连续多次重复按下(注:只是“按下”)的动作,比如,鼠标连续双击、三击、……、多次连击。说明:多次重复按下时,事件序列是这样的:UIControlEventTouchDown -> (UIControlEve 阅读全文
posted @ 2013-10-26 08:33 做个不善的人 阅读(6410) 评论(0) 推荐(0)
XCode之entitlement
摘要:entitlement是codesign的一个输入,参见:codesign。entitlement的意思是权力,也就是表明应用所具有的权利,可以访问什么,不能访问什么等。这些信息会在codesign时成为应用signature的一部分。应用执行时,系统可以根据这个entitlement的信息限制应用可以做的事情。系统中不同的service有不同的entitlement,比如keychain有keychain-access-groups;iCloud有com.apple.developer.ubiquity-container-identifiers和com.apple.developer.ub 阅读全文
posted @ 2013-09-05 13:35 做个不善的人 阅读(2594) 评论(0) 推荐(0)
keychain 中的概念理解
摘要:kSecAttrAccessible这个属性控制Keychain中的一个Item什么时候可以被访问,可选值有:kSecAttrAccessibleWhenUnlocked, kSecAttrAccessibleAfterFirstUnlock, kSecAttrAccessibleAlways, kSecAttrAccessibleWhenUnlockedThisDeviceOnly,kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly,kSecAttrAccessibleAlwaysThisDeviceOnly。带有ThisDeviceOnly的意 阅读全文
posted @ 2013-09-05 13:23 做个不善的人 阅读(1972) 评论(0) 推荐(0)
Grand Central Dispatch (GCD)
摘要:1. 关于dispatch_oncedispatch_onceExecutes a block object once and only once for the lifetime of an application.在stackoverflow上有个对dispatch_once的解释,非常棒:What's the exact reason for using dispatch_once in the shared instance accessor of a singleton under ARC?+(MyClass*)sharedInstance{// Static local p 阅读全文
posted @ 2013-09-04 13:07 做个不善的人 阅读(240) 评论(0) 推荐(0)
Event Handling on Mac
摘要:Keyboard/Mouse Event + CocoaAppleEvent + CocoaAppleEvent + CommandLine App(w/o UI) + CoreFoundationAppleEvent + CommandLine App(w/o UI) + CarbonKeyboard/Mouse Event + Carbon 阅读全文
posted @ 2013-07-10 07:09 做个不善的人 阅读(195) 评论(0) 推荐(0)
Foundation and CoreFoundation
摘要:OpenStep was an object-oriented application programming interface (API) specification for an object-oriented operating system that used a non-NeXTSTEP operating system as its core, principally develop... 阅读全文
posted @ 2013-05-16 12:56 做个不善的人 阅读(192) 评论(0) 推荐(0)
详解MAC硬盘中各个文件夹(zz)
摘要:我是从http://blog.sina.com.cn/s/blog_55f899fb0102dqi2.html拷贝过来的,里面有原帖地址,不过我发文时已经失效了。尊重原创哦!打开Macintosh HD你会发现内中有四个文件夹(一般情况下,隐藏文件夹是不可见的,而且,可能会更多,比如安装xcode后会有developer文件夹).分别有——应用程序(Applications)、系统(System)、用户(User)、资料库(Library)。四个文件夹中又分别各有若干数量的文件夹存在。Applications:这个当然就是存放各种软件的位置了。System:包含由Apple安装的系统软件。这此 阅读全文
posted @ 2013-05-08 02:46 做个不善的人 阅读(1684) 评论(0) 推荐(0)