Lan Yi IOS Learning note number arithmetic random Value Graph Association

Source: Internet
Author: User

To Lan Yi the first day of education and learning, the exclusive teaching by Liu Guobin teacher, a day down feeling very substantial, and on no basis to learn how to use the simple digital operation and Graphics Association in Xcode. Teacher Liu Teaching way more interesting vivid, class is very active, we this batch of students fewer, so the study atmosphere is rich, take today's notes to tidy up.

———————————— first is the calculation of simple numbers ———————————————

?

?

int c = 1231233123;

float a = 10;

float B = 232.23;

float d = a-b-c;

NSLog (@ "%f", D);

UILabel *v = [[UILabel alloc]initwithframe:cgrectmake (100, 100,100,100)];

V.text = [NSString stringwithformat:@ "%f", d];

[Self.view Addsubview:v];

———————————————— and the use of random values?———————————————

?

? int x = 5;

int y = 10;

NSLog (@ "%d", x+y);

Random values

int o = arc4random ()%6; 6 is the range

UILabel *l = [[Uilabelalloc]initwithframe:cgrectmake (Arc4random ()% (320-40), Arc4random ()% (568-60), 40, 60)];

L.backgroundcolor = [Uicolor Bluecolor];

L.text = @ "AAA";

[Self.view addsubview:l];

UILabel *h = [[Uilabelalloc]initwithframe:cgrectmake (Arc4random ()% (320-40), Arc4random ()% (568-50), 40, 50)];

H.text = @ "4";

H.backgroundcolor = [Uicolor Redcolor];

[Self.view addsubview:h];

———————————— also have graphical associations ————————————

[Super Viewdidload];

_shang.text = @ "Up";

_zuo.text = @ "Left";

_xia.text = @ "Down";

_you.text = @ "right";

_zhong.text = @ "Medium";

[Self.view Addsubview:_shang];

Lan Yi IOS Learning note number arithmetic random Value Graph association

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.