OC--Structural body

Source: Internet
Author: User

Nspoint\cgpoint (Common) nssize\cgsize (common) nsrect\cgrect (common) Nsrange

Nspoint P1 = Nsmakepoint (10, 10);

Cgpoint P2 = cgpointmake (10, 20); Common

nssize S1 = nsmakesize (50, 50);

Cgsize s2 = cgsizemake (50, 100); Common

Cgpointzero = = Cgpointmake (0, 0); Cgpointzero indicates the origin (corresponding: Cgsizezero Cgrectzero)

How CGRect is created

CGRect r1 = CGRectMake (10, 10, 50, 50);

CGRect r2 = {{0, 0}, {100, 100}};

CGRectMake R3 = {p1, s1};

The premise of using Cgpointzero is to add the Coregraphics framework

CGRect R4 = {Cgpointzero, Cgsizemake (80, 90)};

convert struct to String

NSString *str1 = Nsstringfrompoint (p1);

NSString *str2 = nsstringfromsize (S1);

NSString *STR3 = nsstringfromrect (r1);

Nsrange

Nsrange r1 = Nsmakerange (3, 5);

NSString *STR4 = @ "as God name";

Find the range of a string in str

If not found, length = 0, location = = Nsnotfound = =-1

Nsrange range = [str rangeofstring:@ "God"];

NSLog (@ "location =%ld, length =%ld", range.location, Range.length);

OC--Structural body

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.