xcode--random numbers and UIView common methods

Source: Internet
Author: User

First, Class extension (class extension, anonymous classification)
1. Format
@Interface class name ()
{
Member variable ...
}
Method declaration ...
@end

1. Use
1> written in the. m file
2> is generally used to augment private member variables, @property properties, methods, etc.

Second, random number generation
1.arc4random () generates any positive integers and 0
2.arc4random_uniform (100) generates 0-99 integers (including 0 and 99)

Iii. Common methods of UIView
1.addSubview: (UIView *) Child
Add child controls (the newly added auto-control will be displayed at the top)

2.NSArray *subviews
The child controls added by the Addsubview: method will exist in this array

3.removeFromSuperview
Remove the control itself from the parent control (the control itself is also removed from the parent control's subviews array)

4. (UIView *) Viewwithtag: (int) Matag
* Returns a child control with a tag value of MyTag
* If there are more than one child control tag, only the first matching child control will be returned (the control itself is also included when searching for tag matching controls)

5.UIView *superview
Parent control

xcode--random numbers and UIView common methods

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.