ScrollView Control
(1) constant definition const
The const in OC can replace macro definition # define.
(1.1) can be read within the constant defined in the program. For example:
Const int a = 3;
Int B = 0;
A = B; // invalid compilation error.
B = a; // valid
(1.2) when using const to define a constant, you must determine that the constant object initializes data.
Const int a = 3; // valid
Const int B; // invalid, resulting in compilation errors
(1.3) when the const constant is referenced in the external link file, after the extern is added, a becomes an object with an external link, and its address has the external link feature.
Extern const int a; // valid
Extern const int B = 3; // The constant cannot be assigned again.
Using const saves more memory space than # define. in the program, const only performs one copy of data, while # define defines the number of objects and the number of data copies.
# Defien a 3; // macro
Const int B = 3; // B is not put into memory at this time
Int I = a; // macro replacement, memory allocation
Int j = B; // memory allocation, which will not be allocated later
Int I = a; // macro replacement, memory allocation again
Int J = B; // no memory is allocated.
(2) array data type definition NSArray
NSArray is an array data class in the Foundation framework. NSArray is like a traditional array in C language. It is usually used in defining integer data types to obtain data storage space in memory. The NSArray object is used to store the subview in the view.
// Create an array variable object and define the "subview" of the scrolling View"
NSArray * subviews = [scrollView1 subviews];