9. The 9-palace Algorithm
# Jiugongge computing ideas
-Use the index of the control to calculate the row number and column number of the control.
-Use the column number to calculate the x value of the control.
-Use the row number to calculate the y value of the control.
# HUD
-Other statements: Indicator, cover, and mask
-Translucent HUD practices
-Set the background color to a translucent color.
# Scheduled tasks
-Method 1: performSelector
'''Objc
// Automatically call self's hideHUD method after 1.5s
[Self defined mselector: @ selector (hideHUD) withObject: nil afterDelay: 1.5];
'''
-Method 2: GCD
'''Objc
Dispatch_after (dispatch_time (DISPATCH_TIME_NOW, (int64_t) (1.5 * NSEC_PER_SEC), dispatch_get_main_queue (), ^ {
// Automatically execute the code in the block after 1.5s
Self. hud. alpha = 0.0;
});
'''
-Method 3: NSTimer
'''Objc
// Automatically call self's hideHUD method after 1.5s
[NSTimer scheduledTimerWithTimeInterval: 1.5 target: self selector: @ selector (hideHUD) userInfo: nil repeats: NO];
// If repeats is YES, it means that the self hidHUD method is called every 1.5s.
'''
# FAQs
-A. m file in the project cannot be used.
-Check: Build Phases-> Compile Sources
-A Resource file (such as plist and audio) in the project cannot be used.
-Check: Build Phases-> Copy Bundle Resources
# Model
-What is a model?
-Objects used to store data
-Generally, some pure objects directly inherited from NSObject
-Some internal attributes are provided to store data.
# What are the possibilities of invisible controls?
-The width or height is actually 0.
-Incorrect position (for example, it is a negative number or a large number that has exceeded the screen)
-Hidden = YES
-Alpha <= 0.01
-No background color or content is set.
-The text color may be the same as the background color.