IOS Tutorial -- 1) Objective-C Basics

简介: Objects and classesA class consists primarily of two things: variables that can store data and methodsthat can perform operations.

Objects and classes
A class consists primarily of two things: variables that can store data and methods
that can perform operations.

Subclasses
Classes can also inherit functionality from an existing class

Instance and class variables

Changing the value of an instance variable in one object
will not affect the value of the same variable in all the other objects of that class.
Conversely, only a single copy of a class variable exists. If you change the value of
a class variable from one object, the value of that variable will change for all the
objects of that class

Accessor methods
Accessor methods, sometimes called getters and setters, are usually fairly simple
methods used to get and set instance variables in a class

Class methods
Class methods (also known as static methods) are  methods that are associated directly

with the class rather than the object instance

Events and messages
An event is a message generated by the user interacting with your application’s
controls. For instance, if you tap the screen of your iOS device, this generates a UI
event in your application that is passed via a message from the application to an
object that has been delegated to deal with that specific type of event

Protocols
A protocol definition declares methods that any class can implement. If your class
declares that it abides by a particular protocol definition, you are announcing that
you have implemented the minimum mandatory methods declared in the protocol
definition, and may optionally have implemented some nonmandatory methods

Delegate classes
A delegate class is a class that implements a protocol for handling events.

Event loop
The main event loop is the principal control loop for your application.

Reference Counting

Reference counting is a form of garbage collection, which counts the number of references
to an object (or portion of memory) and frees the associated memory when the
number of references reaches zero. The main advantage of reference counting over
"classic" garbage collection is that memory is freed as soon as it is no longer in use

 

 

目录
相关文章
|
6月前
|
安全 编译器 Swift
IOS开发基础知识: 对比 Swift 和 Objective-C 的优缺点。
IOS开发基础知识: 对比 Swift 和 Objective-C 的优缺点。
377 2
|
2月前
|
设计模式 前端开发 Swift
探索iOS开发:Swift与Objective-C的较量
在这篇文章中,我们将深入探讨iOS开发的两大编程语言——Swift与Objective-C。我们将分析这两种语言的特性、优势和局限性,并讨论它们在现代iOS开发中的应用。无论你是初学者还是有经验的开发者,这篇文章都将为你提供有价值的见解和建议。
55 3
|
3月前
|
开发工具 iOS开发 容器
【Azure Blob】关闭Blob 匿名访问,iOS Objective-C SDK连接Storage Account报错
【Azure Blob】关闭Blob 匿名访问,iOS Objective-C SDK连接Storage Account报错
|
4月前
|
开发工具 iOS开发 容器
【Azure Blob】关闭Blob 匿名访问,iOS Objective-C SDK连接Storage Account报错
iOS Objective-C 应用连接Azure Storage时,若不关闭账号的匿名访问,程序能正常运行。但关闭匿名访问后,上传到容器时会出现错误:“Public access is not permitted”。解决方法是将创建容器时的公共访问类型从`AZSContainerPublicAccessTypeContainer`改为`AZSContainerPublicAccessTypeOff`,以确保通过授权请求访问。
【Azure Blob】关闭Blob 匿名访问,iOS Objective-C SDK连接Storage Account报错
|
6月前
|
缓存 开发工具 iOS开发
优化iOS中Objective-C代码调起支付流程的速度
优化iOS中Objective-C代码调起支付流程的速度
94 2
|
6月前
|
安全 JavaScript 前端开发
IOS开发基础知识:介绍一下 Swift 和 Objective-C,它们之间有什么区别?
IOS开发基础知识:介绍一下 Swift 和 Objective-C,它们之间有什么区别?
258 0
|
iOS开发 容器
iOS 代码规范格式 Objective-C(上)
iOS 代码规范格式 Objective-C
429 0
iOS 代码规范格式 Objective-C(上)
|
编译器 API iOS开发
iOS 代码规范格式 Objective-C(下)
iOS 代码规范格式 Objective-C(下)
235 0
|
机器学习/深度学习 API iOS开发
【IOS 开发】Objective-C Foundation 框架 -- 字符串 | 日期 | 对象复制 | NSArray | NSSet | NSDictionary | 谓词(一)
【IOS 开发】Objective-C Foundation 框架 -- 字符串 | 日期 | 对象复制 | NSArray | NSSet | NSDictionary | 谓词(一)
178 0
|
存储 自然语言处理 Java
【IOS 开发】Objective-C Foundation 框架 -- 字符串 | 日期 | 对象复制 | NSArray | NSSet | NSDictionary | 谓词(二)
【IOS 开发】Objective-C Foundation 框架 -- 字符串 | 日期 | 对象复制 | NSArray | NSSet | NSDictionary | 谓词(二)
249 0