Parent-child controls
- Each control is a container that can hold other controls
- The inner gizmo is a child of the large control
Common Properties
-
Get your own parent control object
@property ( nonatomic,retain)
uiview *superview;
-
Gets all of its child control objects-the order of the array elements determines the display level of the child controls
@property ( Span class= "Hljs-keyword" >nonatomic,readonly,copy) nsarray *subview;
-
-(void) Addsubview: (UIView *) view;
- Add a child control view
- Example:-(ibaction) ButtonClick {Uiswitch *s = [[Uiswitch alloc]init]; [Self.view addsubview:s]; }
-
(void) Removeformsuperview;
from the parent control
//CGRect是一个结构体,有四个小属性,位置坐标和大小//控件矩形框在父控件中得位置和尺寸(以父控件的左上角为坐标原点)//向右为x正方向,纵向向下为y轴正方向。x,y分别表示距矩形边框的距离- @property(nonatomic)CGRect frame;- @property(nonatomic)CGRect bounds;//控件矩形框的位置和尺寸(以自己左上角为坐标原点,所以bounds的x、y一般为0)- @proerty(nonatomic)CGPoint center;//控件中点的位置(以父控件的左上角为坐标原点)
Watch out.
- When the button is set, the Type property is initially in the system state, which is dimmed when the button is clicked.
- You need to set the Type property to custom when you define a button that is highlighted, unavailable, and so on.
Display indicator
- Several ways to hide controls
self.addBtn.hidden = YES; 设置为隐藏self.addBtn.alpha = 0; 设置透明度,默认是1.0(100%不透明)[self.addBtn removeFormSuper]; 直接删除
The SEL type is actually the wrapper for the method @selector (method name)
Ways to implement Timers
- Method 1:performselector
[self performSelector:@selector(hideHUD) withObject:nil afterDelay:2.0]参数一:SEL方法参数二:参数参数三:?s延迟
- Method 2:GCD
-
Dispatch_after (Dispatch_time (Dispatch_time_now, (int64_t) (1.5 * nsec_per_sec)), Dispatch_get_main_queue (), ^{
self.hud.alpha = 0.0;
});
-
Method 3:nstimer (When Repeats=yes, the method is called every 1.5s)
- [Nstimer scheduledtimerwithtimeinterval:1.5 target:self selector: @selector (*) Userinfo:nil Repeats:no];
Hud
- Other claims: indicator, masking, masking
- Semi-transparent HUD procedure:
- Background color set to translucent color
Problems
-
A. m file inside the project cannot be used-:build phases, Complie Sources
-
A resource file within the project (such as plist, audio, etc.) cannot be used
- Check: Build phases, Copy Bundle Resource
- What is a model?
- Objects that are designed to hold data
- are generally pure objects that are directly integrated with NSObject
- Some properties are provided internally to hold the data
iOS Development UI Basic Learning-------Summary