In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
2025-10-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article shows you the sample analysis of UIView view, which is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
Create a view
UIView * view = [UIView alloc] initWithFrame:CGRectMake (220,100,100,100)]
View.backgroundColor = [UIColor greenColor]
[self.window addSubview:view]
[view release]
The view1.center center property gets the center point of the view.
NSStringFromCGPoint converts a CGPoint type structure variable to a string type.
NSLog (@ "% @", NSStringFromCGPoint (view1.center))
Frame of the view
NSLog (@ "% @", NSStringFromCGRect (view1.frame))
Transparency alpha
View1.alpha = 0.5
Explicit and implicit hidden 1 hide 0 does not hide default: do not hide
View1.hidden = 0
[self.window addSubview:view1]; / / add directly to the front
View1.frame = CGRectMake (120,234,100,100)
[self.window addSubview:view1]
View1.frame = CGRectMake (120,333,100,100)
[self.window addSubview:view1]
[self.window insertSubview:view1 atIndex:0]; / / add to the 0 position of the array
[self.window insertSubview:view1 aboveSubview:view]; / / insert the View1 subview into the view
[self.window insertSubview:view1 belowSubview:view]; / / insert the View1 subview under the view
View1.tag = 100; / / tag is used to uniquely identify a view (given above 100)
Get all the child view subviews of the view
Views manage all child views in the form of an array, and the order in the array is the same as the order in which the views are submitted.
If the added view coincides with the previously added view, the first added view will be overwritten.
NSLog (@ "% @", self.window.subviews)
Get the parent view superview of the view
NSLog (@ "% @", view1.superview)
[view1 release]
[self.window viewWithTag:100]
Obtain the corresponding child view through the teg value of the parent view and the child view
The above is a sample analysis of the UIView view. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.