Uilable UIBUtton Uitextfield
-(BOOL) application: (uiapplication *) application didfinishlaunchingwithoptions: (nsdictionary *) launchoptions {
Override point for customization after application launch.
self. Window = [[UIWindow alloc]initwithframe: [[UIScreen mainscreen]bounds]];
[Self. Window setbackgroundcolor: [Uicolor Graycolor]];
[Self. Window makekeyandvisible];
[self createlabel];
[self CreateField];
[self Createbutton];
return YES;
}
-(void) Createlabel
{
UILabel *alabel = [[UILabel alloc]initwithframe:cgrectmake ( [n], []];
[Alabel setbackgroundcolor: [Uicolor Whitecolor]];
[Self. window Addsubview:alabel];
[Label settext:@ "mother Fuck"];
Alabel. text = @ "Fuck off,bitch afasfsfasfas!131311231";
[Label Settextcolor:[uicolor Blackcolor];
Alabel.textcolor = [Uicolor redcolor];
Center Text
[Alabel settextalignment: Nstextalignmentcenter];
// set font
//Create an object to accept
Uifont *newfont = [Uifont systemfontofsize:25];
Uifont *newfont1 = [Uifont boldsystemfontofsize:25];
Uifont *newfont2 = [Uifont italicsystemfontofsize:];
[Alabel Setfont:newfont2];
//Line Note height , as long as the height is enough, set to 0
Alabel. numberoflines = 0;
[Alabel setshadowcolor: [Uicolor Bluecolor]];
[Alabel setshadowoffset: Cgsizemake(1, 2)];
set tag value to take content
[Alabel settag:100];
[Alabel release];
}
Input box
-(void) CreateField
{
local variables, Self.afiedl relative global variables
self. Afield = [[Uitextfield alloc]initwithframe: CGRectMake( +, +, +)];
[_afield setbackgroundcolor: [Uicolor Whitecolor]];
[Self. Window addsubview: _afield];
[Afield settext:@ " enter password"];
[_afield settextalignment: Nstextalignmentleft];
[Afield setalpha:1];
[_afield settextcolor: [Uicolor Graycolor]];
set prompt placeholders
[_afield setplaceholder:@ " Enter password "];
//Enter character and change to Asterisk
_afield. Securetextentry = YES;
[_afield release];
}
-(void) Createbutton
{
UIButton *button = [UIButton buttonwithtype: Uibuttontypecustom];
// location
[Button setframe:cgrectmake ( +,,,)];
[Button SetBackgroundColor: [Uicolor Purplecolor];
[Self. window Addsubview:button];
[Button Settitle:@ " dot " forstate: UIControlStateNormal ];
[Button Settitle:@ " checked " forstate: uicontrolstatehighlighted ];
[Button Settitlecolor: [Uicolor yellowcolor] forstate: uicontrolstatehighlighted];
//Add a click event
UIControlEventTouchUpInside Click to lift up
[Button AddTarget:self Action:@selector(buttonaction:) forcontrolevents: UIControlEventTouchUpInside];
}
-(void) Buttonaction: (ID) sender
{
NSLog (@ "%s", __func__);
//Let the input box lose the first responder
[self. Afield Resignfirstresponder];
//tag Value The parent view finds himself and all child views with a tag value of 100
UILabel *aview = (UILabel *) [Self. Window viewwithtag: +];
I 'm going to give filed a label.
[Aview setText: Self. Afield. text];
}
iOS UI section two basic controls