Add a background picture to the parent view
Uiimageview *imgview=[[uiimageview alloc] initwithimage:[uiimage imagenamed:@ "Beijing"];
@ "" is the file name, so write the background picture must be dragged into the project to
Imgview.frame=self.view.bounds;
Automatically adapts to screen size
Imgview.autoresizingmask=uiviewautoresizingflexiblewidth;
Add a background picture to the parent view
[Self.view Insertsubview:imgview atindex:0];
Child view added to the specified location
Self.headview=[[uiimageview Alloc] Initwithframe:cgrectmake (45, 100, 30, 30)];
Add a picture with the file name [email protected]
[Self.headview setimage:[uiimage imagenamed:@ "[email protected]"];
[Self.view AddSubview:self.headView];
Add button
Self.buttonregister=[uibutton Buttonwithtype:uibuttontyperoundedrect];
Determine the position of the button in the parent view
Self.buttonregister.frame=cgrectmake (45, 300, 320, 50);
Set the name of the button
[Self.buttonregister settitle:@ "registration" forstate:uicontrolstatenormal];
The rounded corner of the button, the larger the value, the greater the rounded angle
self.buttonregister.layer.cornerradius=10;
Set the background color of the button
Self.buttonregister.backgroundcolor=[uicolor Whitecolor];
Sets the size and width of the font inside the button
_buttonregister.titlelabel.font=[uifont systemfontofsize:25 Weight:10];
Configure the color of the font inside the button
[Self.buttonregister settitlecolor:[uicolor colorwithred:0.176 green:0.627 blue:0.588 alpha:1] ForState: UIControlStateNormal];
Add a button view to the parent view
[Self.view AddSubview:self.buttonRegister];
Touch function
-(void) Touchesbegan: (Nsset<uitouch *> *) touches withevent: (Uievent *) event
{
Call the Hide keyboard function
[Self hidekeyboard];
}
/**
* Hide Keyboard functions
*/
-(void) Hidekeyboard
{
Determine if the response is first
if ([Self.textname1 isfirstresponder]| | [Self.textname2 Isfirstresponder])
{
Loss of First response
[Self.textname1 Resignfirstresponder];
[Self.textname2 Resignfirstresponder];
}
}
UI Basic View Control