#import"AppDelegate.h"@interface appdelegate () @end @implementation appdelegate-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchoptions {Self.window=[[[UIWindow alloc] initwithframe:[[uiscreen mainscreen] bounds]] autorelease]; //Override point for customization after application launch.UIView*containterview =[[UIView alloc] initwithframe:[[uiscreen mainscreen] bounds]; Containterview.tag= -; Containterview.backgroundcolor=[Uicolor Whitecolor]; [Self.window Addsubview:containterview]; [Containterview release]; /*Uitextfield: It is on the basis of Uilabel, more text editing can be more common, you can allow users to enter and edit text. To inherit from Uicontrol Uitextfield use Step 1. Create 2. Edit Properties 3. Tim Add to Parent View 4. Free up occupied space*/Uitextfield*textfield = [[Uitextfield alloc] Initwithframe:cgrectmake (Ten, -, -, -)]; Textfield.tag= $; [Containterview Addsubview:textfield]; Textfield.backgroundcolor=[Uicolor Whitecolor]; [TextField release]; //set the prompt text for the input box (placeholder)Textfield.placeholder =@"Please enter your password"; //Textfield.text = @ "38 feet";Textfield.font= [Uifont fontwithname:@"Avenirnextcondensed-heavyitalic"Size *]; //Text Correspondence Method//textfield.textalignment = nstextalignmentcenter;Textfield.textalignment =Nstextalignmentleft; //sets whether the text box can be edited//textfield.enabled = NO; //empty the contents of the input box when the input box starts to edit//textfield.clearsonbeginediting = YES; //textfield.clearsoninsertion = YES; //textfield.clearscontextbeforedrawing = YES; //Textfield.textcolor = [Uicolor bluecolor];Textfield.font = [Uifont systemfontofsize: -]; //Set the input box to display as a passwordTextfield.securetextentry =YES; //Numeric Keypad//textfield.keyboardtype = Uikeyboardtypenumberpad; //set the type style of the return keyTextfield.returnkeytype =Uireturnkeygo; //set input border styleTextfield.borderstyle =Uitextborderstyleroundedrect; //Customizing the keyboard /*UIView *inputview = [[UIView alloc] Initwithframe:cgrectmake (0, 0, 200, 200)]; Inputview.backgroundcolor = [Uicolor Cyancolor]; Textfield.inputview = Inputview; [Inputview release]; */ /** * Set auxiliary view on keyboard*///UIView *inputaccessoryview = [[UIView alloc] Initwithframe:cgrectmake (0, 0, +/-)];//Inputaccessoryview.backgroundcolor = [Uicolor yellowcolor];//Textfield.inputaccessoryview = Inputaccessoryview;//[Inputaccessoryview release]; //Set the Input box Clear button mode//Textfield.clearbuttonmode = uitextfieldviewmodewhileediting; //Set the input box proxyTextField.Delegate=Self ; Self.window.backgroundColor=[Uicolor Whitecolor]; [Self.window makekeyandvisible]; returnYES;}- (void) Applicationwillresignactive: (UIApplication *) Application {//Sent when the application are about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as a incoming phone call or SMS message) or when the US Er quits the application and it begins the transition to the background state. //Use the This method to the pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.}- (void) Applicationdidenterbackground: (UIApplication *) Application {//Use the method to release the shared resources, save user data, invalidate timers, and store enough application state in Formation to the restore your application to the it is terminated later. //If Your application supports background execution, this method is called instead of Applicationwillterminate:when th E user quits.}- (void) Applicationwillenterforeground: (UIApplication *) Application {//Called as part of the transition from the background to the inactive state; Here you can undo many of the changes mad E on entering the background.}- (void) Applicationdidbecomeactive: (UIApplication *) Application {//Restart Any tasks this were paused (or not yet started) while the application is inactive. If the application is previously in the background, optionally refresh the user interface.}- (void) Applicationwillterminate: (UIApplication *) Application {//Called when the application are about to terminate. Save data if appropriate. See also Applicationdidenterbackground:.}- (void) dealloc{[_window release]; [Super Dealloc];}#pragmaMark--Uitextfielddelegate//When you click on the minus disk, the return triggers the method .-(BOOL) Textfieldshouldreturn: (Uitextfield *) TextField; { //Cancel the first response to this[TextField Resignfirstresponder]; returnYES;}- (void) touchesended: (Nsset *) touches withevent: (Uievent *)Event{UIView*containerview = [Self.window viewwithtag: -]; Uitextfield*TEXTFD = (Uitextfield *) [Containerview Viewwithtag: $]; [Textfd Resignfirstresponder];} @end
text box (Uitextfield) in iOS