Self.window = [[UIWindow alloc]initwithframe:[uiscreen mainscreen].bounds];
Viewcontroller * VC =[[viewcontroller Alloc]init];
Self.window.rootViewController = VC;
Self.window.backgroundColor = [Uicolor Graycolor];
Makekeyandvisible: Make the window the main window and display it on the screen
[Self.window makekeyandvisible];
/*
* Inheritance relationships between controls
* nilable
* Uiimageview
*/
UIView display a color-colored view
UIView *view = [[UIView alloc]init];
View.frame = CGRectMake (100, 100, 300, 300);
[Self.window Addsubview:view];
View.backgroundcolor = [Uicolor Orangecolor];
Uilable Label control, suitable for putting some short text.
Uilable inherited from UIView
Instantiate the Lable object, and any object must be instantiated
UILabel * lable = [[UILabel alloc]init];
Set frame for lable
Lable.frame = CGRectMake (200, 200, 200, 200);
Set Text to Uilable
Lable.text = @ "Zkysdfdsghhhjjghjkgiu";
Lable.textcolor = [Uicolor Whitecolor];
To set the alignment for uilable:
Lable.textalignment =nstextalignmentnatural;
Uifont Uicolor are classes that need to be instantiated as objects they create.
Font size
Lable.font = [Uifont systemfontofsize:25];
Bold font also sets the size of the font
Lable.font = [Uifont boldsystemfontofsize:26];
Font size is also set when italic is set
Lable.font = [Uifont italicsystemfontofsize:28];
Set shadow and set shadow color
Lable.shadowcolor = [Uicolor Bluecolor];
Set the shadow offset
Lable.shadowoffset = Cgsizemake (6, 6);
Set the number of rows to the content, 0 for the adaptive row count, not 0 for a few rows
Lable.numberoflines = 0;
Self-adapting fonts to make content appear as one line
Lable.adjustsfontsizetofitwidth = YES;
Lable.backgroundcolor = [Uicolor Redcolor];
[Self.window addsubview:lable];
Set Imgview display Picture
Uiimageview *imgview =[[uiimageview Alloc]init];
If the picture is in PNG format, the picture does not need to be suffixed, otherwise it must be added
Imgview.image = [UIImage imagenamed:@ "Boy1.tiff"];
Imgview.frame = CGRectMake (10, 10, 300, 200);
[Self.window Addsubview:imgview];
/*
* Create three elements of frame animation
* 1, set the interval time
* 2, prepare the picture material
* 3, set the number of repetitions
* 4, start animation
*/
Animationduration to set the animation time interval
Imgview.animationduration = 1;
Put the instantiated object into the array
UIImage * img1=[uiimage imagenamed:@ "Boy1.tiff"];
UIImage * img2=[uiimage imagenamed:@ "Boy2.tiff"];
UIImage * img3=[uiimage imagenamed:@ "Boy3.tiff"];
UIImage * img4=[uiimage imagenamed:@ "Boy4.tiff"];
UIImage * img5=[uiimage imagenamed:@ "Boy5.tiff"];
UIImage * img6=[uiimage imagenamed:@ "Boy6.tiff"];
UIImage * img7=[uiimage imagenamed:@ "Boy7.tiff"];
UIImage * img8=[uiimage imagenamed:@ "Boy8.tiff"];
Nsarray * array = @[img1,img2,img3,img4,img5,img6,img7,img8];
Animationimages preparing footage for frame animations
Imgview.animationimages =array;
RepeatCount set Number of repetitions
Imgview.animationrepeatcount = 50;
Start animation
[Imgview startanimating];
End Animation
[Imgview stopanimating];
Control inheritance, animation