Skip to Main Content
iOS 编程基础:Swift、Xcode 和Cocoa 入门指南
book

iOS 编程基础:Swift、Xcode 和Cocoa 入门指南

by Matt Neuburg
January 2017
Intermediate to advanced content levelIntermediate to advanced
552 pages
9h 43m
Chinese
China Machine Press
Content preview from iOS 编程基础:Swift、Xcode 和Cocoa 入门指南
C
Objective-C
Swift
517
AudioServicesDisposeSystemSoundID(snd)
}
这是用于播放音频文件(作为系统声音)的代码,包含了对
AudioServicesAddSystemS
oundCompletion
的调用:
let sndurl =
NSBundle.mainBundle().URLForResource("test", withExtension: "aif")!
var snd : SystemSoundID = 0
AudioServicesCreateSystemSoundID(sndurl, &snd)
AudioServicesAddSystemSoundCompletion(snd, nil, nil, soundFinished, nil)
AudioServicesPlaySystemSound(snd)
A.2 Objective-C
Objective-C
构建在
C
之上。它添加了一些语法与特性,不过继续使用着
C
语法与数据
类型,其底层依然是
C
Swift
不同,
Objective-C
没有命名空间。出于这个原因,不同框架通过不同的前缀作
为名字的开始以进行区分。“
CGFloat
”中的“
CG
”表示
Core Graphics
,因为它声明在
Core Graphics
框架中。“
NSString
”中的“
NS
”表示
NeXTStep
,这是
Cocoa
框架过去
的名字,诸如此类。
A.2.1
 
Objective-C
对象与
C
指针
所有的
C
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

机器学习实战:基于Scikit-Learn、Keras 和TensorFlow (原书第2 版)

机器学习实战:基于Scikit-Learn、Keras 和TensorFlow (原书第2 版)

Aurélien Géron
Swift 人工智能实战:从基础理论到AI 驱动的应用程序开发

Swift 人工智能实战:从基础理论到AI 驱动的应用程序开发

Mars Geldard, Jonathon Manning, Paris Buttfield-Addison, Tim Nugent

Publisher Resources

ISBN: 9787111556350