UIWindow (UIView)
1.創建一個uiwindow對象
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
2.backgroundColor
背景顏色
3.- (void)makeKeyAndVisible;
eg: [self.window makeKeyAndVisible];
設置這個window爲主windows,並使其可見
4.rootViewController
把一個視圖控制器指定爲windows的根視圖控制器
eg:self.window.rootViewController = mainVC;
UIView : UIResponder <NSCoding, UIAppearance, UIAppearanceContainer, UIDynamicItem, UITraitEnvironment, UICoordinateSpace>
1.創建一個UIView對象
UIView *view = [[UIView alloc]initWithFrame:CGRectMake(150, 150, 55, 55)];
2.backgroundColor
背景顏色
3.- (void)addSubview:(UIView *)view;
eg:[self.window addSubview:view];
添加一個view到self.window上
4.- (void)bringSubviewToFront:(UIView *)view;
eg:[self.window bringSubviewToFront:view];
將一個View放到最前面
5.- (void)sendSubviewToBack:(UIView *)view;
[self.window sendSubviewToBack:view];
將一個view放到後面
6.- (void)removeFromSuperview;
eg:[view removeFromSuperview];
將某個view從父視圖移除
注意:調用該方法 會使得自己引用計數-1 如果 view上還有view 一併移除掉
7.alpha
透明度 (0 - 1float)帶着所有子視圖透明度一起改變
eg:View.alpha = 0.3;
8.hidden
隱藏(YES隱藏 / NO顯示)
view.hidden = YES;
9.superview
eg:NSLog(@"view的父視圖:%@“,view.superview);
10.subviews
eg:NSLog(@“view的子視圖:%@“,view.subviews);
11.tag
eg:view.tag = 10000;
給view加一個編號,方便父視圖查找某個子視圖
12.- (UIView *)viewWithTag:(NSInteger)tag;