iOS开发笔记 2、Cocoa简明

历史

NeXSTEP

Many years ago Cocoa was known as NeXTSTEP . NeXT Computer developed and released version 1.0 ofNeXTSTEP in September of 1989, and versions 2.0 and 3.0 followed not far behind (in 1990 and 1992,respectively). In this early phase, NEXTSTEP was more than an application environment; the term referred tothe entire operating system, including the windowing and imaging system (which was based on DisplayPostScript), the Mach kernel, device drivers, and so on.Back then, there was no Foundation framework. Indeed, there were no frameworks; instead, the softwarelibraries (dynamically shared) were known as kits, the most prominent of them being the Application Kit.Much of the role that Foundation nowoccupieswas taken by an assortment of functions, structures, constants,and other types. The Application Kit itself had a much smaller set of classes than it does today. In addition to the Application Kit, the early NeXTSTEP included the Sound Kit and the Music Kit, librariescontaining a rich set of Objective-C classes that provided high-level access to the Display Postscript layer foraudio and music synthesis.

 

OpenStep

In early 1993 NeXTSTEP 3.1 was ported to (and shipped on) Intel, Sparc, and Hewlett-Packard computers.NeXTSTEP 3.3 alsomarked amajor new direction, for it included a preliminary version of Foundation. Aroundthis time (1993), the OpenStep initiative also took form. OpenStep was a collaboration between Sun andNeXT to port the higher levels of NeXTSTEP (particularly the Application Kit and Display PostScript) to Solaris.The “Open” in the name referred to the open API specification that the companies would publish jointly. Theofficial OpenStep API, published in September of 1994, were the first to split the API between Foundationand Application Kit and the first to use the “NS” prefix.

By June 1996 NeXT had ported and shipped versions of OpenStep 4.0 that could run Intel, Sparc, andHewlett-Packard computers as well as an OpenStep runtime that could run on Windows systems. Sun alsofinished their port of OpenStep to Solaris and shipped it as part of their Network Object ComputingEnvironment. OpenStep, however, never became a significant part of Sun’s overall strategy.

Cocoa

When Apple acquired NeXT Software (as it was then called) in 1997 ,OpenStep became the Yellow Box andwas included with Mac OS X Server (also known as Rhapsody) and Windows. Then, with the evolution of theMac OS X strategy, it was finally renamed to “Cocoa.”

Cocoa Framework

框架的组成,包括基础和应用

■ Mac OS X: Foundation and Application Kit

■iOS: Foundation and UIKit

Foundation

The Foundation framework defines a base layer of classes that can be used for any type of Cocoa program.The criterion separating the classes in Foundation from those in the Application Kit is the user interface.

Application Kit (Mac OS X)

The Application Kit (which is sometimes referred to as the AppKit) is a framework containing all the objectsyou need to implement your graphical, event-driven user interface on Mac OS X: windows, dialogs, buttons,menus, scrollers, text fields—the list goes on.

UIKit (iOS)

The UIKit framework on iOS is the sister framework of the Application Kit onMac OS X. Its purpose is essentiallythe same: to provide all the classes that an application needs to construct and manage its user interface.However, there are significant differences in how the frameworks realize this purpose.

Core Data

Core Data is a Cocoa framework that provides an infrastructure formanaging object graphs, including supportfor persistent storage to a variety of file formats. Object-graph management includes features such as undoand redo, validation, and ensuring the integrity of object relationships. Object persistence means that CoreData saves model objects to a persistent store and fetches them when required. The persistent store of aCore Data application—that is, the ultimate form in which object data is archived—can range from XML filesto SQL databases. Core Data is ideally suited for applications that act as front ends for relational databases,but any Cocoa application can take advantage of its capabilities.

Other Frameworks With Cocoa API

除了以上的基础框架以外,还有各种基于Cocoa的其他框架,如:

Sync Services—(Mac OS X only)

Address Book

Preference Panes—(Mac OS X only)

Screen Saver—(Mac OS X only)

iAd—(iOS only)

Map Kit—(iOS only)

知道了这些基本概念后,可以熟悉一下“Cocoa Fundamentals Guide”文档

然后参考一些相关的文档和例子就可以熟悉整个的框架情况

Cocoa Fundamentals Guide

■ Cocoa Fundamentals Guide

introduces the basic concepts, terminology, architectures, and design patternsof the Cocoa frameworks and development environment.

http://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaFundamentals.pdf

这个官方文档包含了很多信息

特别4,5章描述了Cocoa中使用到的设计模式和对象之间的通讯形式,非常重要,否则使用这些类时,如果对设计模式等不熟悉的话,估计会一头雾水

时间: 2024-08-04 08:12:12

iOS开发笔记 2、Cocoa简明的相关文章

IOS开发笔记 IOS如何访问通讯录

    IOS开发笔记  IOS如何访问通讯录 其实我是反对这类的需求,你说你读我的隐私,我肯定不愿意的. 幸好ios6.0 以后给了个权限控制.当打开app的时候你可以选择拒绝. 实现方法: [plain] view plaincopy //读取所有联系人      -(void)ReadAllPeoples      {              //取得本地通信录名柄              ABAddressBookRef tmpAddressBook = nil;         

【Swift】iOS开发笔记(一)

1.隐藏/显示密码功能 光设置secureTextEntry还不行,你会发现UITextField在切换到显示密码时会多一个空字符,看着巨别扭,需要在更改secureTextEntry后进行如下设置:         let pwd = psdField.text         self.psdField.text = pwd + " "         self.psdField.text = pwd 2.获取当前类的名称 String.fromCString(object_get

【Swift 2.2】iOS开发笔记(三)

1.UITableView 中调用 UIButton 的 setTitle 会闪 滚动列表时比较明显,解决办法: buttonType 改成 custom 即可,但是这样一来 UIButton 的高亮效果也没了,但可以自己手动配置 State Config  2.监听 UITextField 文本改变 func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementSt

IOS开发笔记

1 iphone开发笔记 2 3 退回输入键盘 4 - (BOOL) textFieldShouldReturn:(id)textField{ 5 [textField resignFirstResponder]; 6 } 7 8 CGRect 9 CGRect frame = CGRectMake (origin.x, origin.y, size.width, size.height):矩形 10 NSStringFromCGRect(someCG) 把CGRect结构转变为格式化字符串:

IOS开发笔记整理49之详解定位CLLocation_IOS

在项目功能中有一个定位CLLocation的需求,遇到了一些知识难点,经过各位大侠的帮助,问题解决,特此分享供大家学习,希望大家共同学习进步. 一.简单说明 1.CLLocationManager CLLocationManager的常用操作和属性 开始用户定位- (void)startUpdatingLocation; 停止用户定位- (void) stopUpdatingLocation; 说明:当调用了startUpdatingLocation方法后,就开始不断地定位用户的位置,中途会频繁

iOS开发笔记--详解UILabel的相关属性设置_IOS

在iOS编程中UILabel是一个常用的控件,下面分享一下UILabel的相关属性设置的方法. 很多学习iOS6编程都是从storyboard开始,用到UILabel时是将控件拖到storyboard中生成实现,如果想要在-(void)viewDidLoad中用代码如[_label initWithFrame:CGRectMake(X,Y,WIDTH,HEIGHT)]方法改变拖拽到storyboard的label的大小是行不通的,因为程序加载时先执行了-(void)viewDidLoad的代码,

iOS开发笔记 4、iOS中的Cocoa、设计模式等

Cocoa中常用的类 NSStringNSMutableString 赋值 NSString *myString = @"some string"; NSString *myString = [NSStringstringWithFormat:@"object = %@",someObject]; 转换 NSString *upper = [myStringuppercaseString]; intintString = [myStringintValue]; 去内

iOS开发笔记 6、View Controllers【MVC】

了解和熟悉这个对后续的开发很重要.   关于这个的参考资料 ■ View Controller Programming Guide for iOS For information about structuring and managing your application's user interface http://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/ViewControl

iOS开发笔记 7、数据【Preferences、文件、库、Core Data】

程序开发中根据要使用各种各样的数据,如配制.文件系统.数据库等,iOS对这个有很好的支持 Preferences If you're going to create a program that has built-in preferences, you should do so using the Utility Application template. To create the special cartouched list used by preferences, you must c