IOS: common attributes, methods, and ios attributes

Source: Internet
Author: User

IOS: common attributes, methods, and ios attributes

It is easy to forget the previous knowledge if you have not been in touch for a while. I wrote an article for months, but I forgot to pick it up.

 

0. macro definition

// Frame [UIScreen mainScreen]. bounds of the current mobile phone

 

1. UILabel

1-1) attributes of UILabel

// Content label. text // font label. font = [UIFont systemFontOfSize: fontSize]; // system label. font = [UIFont fontWithName: @ "Times New Roman" size: fontSize]; // Times New Roman body label. font = [UIFont italicSystemFontOfSize: fontSize]; // italic label. font = [UIFont boldSystemFontOfSize: fontSize]; // bold // default left-aligned label. textAlignment = NSTextAlignmentLeft; // wrap label. numberOfLines = 0; // default mode. The line feed ensures a complete word label. lineBreakMode = NSLineBreakByWordWrapping;

  

 

 

 

 

1. View

1-1) View attributes

// Rotate a view. transform = CGAffineTransformRotate (view. transform, M_PI); // zoom in width 1.5 times, zoom in 1.5 times, view. transform = CGAffineTransformScale (view. transform, 1.5, 1.5 );

  

 

1-2) View layer

// Set the rounded corner [view. layer setCornerRadius: 100]; // sets the border [view. layer setBorderWidth: 2.0]; // sets the border color [view. layer setBorderColor: [[UIColor grayColor] CGColor];

 

1-3) View Method

// Move the sub-View to the front [self. view bringSubviewToFront: view]; // All subviews NSArray * array = [self. view subviews]; // remove all subviews. Use for infor (UIView * view in array) {[view removeFromSuperview];}

  

2. navigation bar

// Launch a new view and use POP to return the view. Only the Controller can push the view. View cannot push [self. navigationController pushViewController: root animated: YES];

  

3. Table View

3-1) default cell attributes

// Content cell. textLabel. text = @ "xxx"; // detailed content cell. detailTextLabel. text = @ "xxx"; // image, png can have no suffix. jpg must be available. For the sake of rigor, write down the png file! Cell. imageView. image = [UIImage imageNamed: @ "xxx"]; // no gray cell is displayed when you click it. selectionStyle = UITableViewCellSelectionStyleNone; // cell on the right. accessoryType = UITableViewCellAccessoryDisclosureIndicator; // custom View on the right. The most common case is an arrow number, indicating loading more cells. accessoryView = view; // note that contentView is usually used for adding a Cell. It is a little different from adding a cell directly. contentView addSubview: view]; (here is the UILabel attribute) // unlimited rows = automatic line feed, cell. textLabel. numberOfLines = 0; // font style, size setting, cell. textLabel. font

  

  

 

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.