//
Appdelegate.m
Ui_lesson1
//
Created by Li Hongpeng on 15/6/29.
Copyright (c) 2015 Li Hongpeng. All rights reserved.
//
#import "AppDelegate.h"
#define KWINDTH 150
#define Kheight 45
#define Kmargin 20
@interface Appdelegate ()
@end
@implementation Appdelegate
-(void) dealloc
{
[_window release];
[Super Dealloc];
}
-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchOptions {
Override point for customization after application launch.
Self.window = [[[UIWindow alloc] Initwithframe:[uiscreen mainscreen].bounds] autorelease];
Self.window.backgroundColor = [Uicolor Greencolor];
[Self.window makekeyandvisible];
UIView *usename2 = [[UIView alloc] Initwithframe:cgrectmake (+, Kwindth, kheight)];
Usename2.backgroundcolor = [Uicolor Redcolor];
[Self.window addsubview:usename2];
UIView *aview = [[[UIView Alloc] Initwithframe:cgrectmake (Cgrectgetminx (Usename2.frame), Cgrectgetmaxy ( Usename2.frame) + Kmargin, Kwindth, Kheight)] [autorelease];
Aview.backgroundcolor = [Uicolor Redcolor];
[Self.window Addsubview:aview];
UIView *bview = [[[[UIView Alloc] Initwithframe:cgrectmake ([[]] autorelease];
Bview.backgroundcolor = [Uicolor Orangecolor];
[Self.window Addsubview:bview];
//
UIView *cview = [[[[UIView Alloc] Initwithframe:cgrectmake ([[]] autorelease];
Cview.backgroundcolor = [Uicolor Orangecolor];
[Self.window Addsubview:cview];
UIView *view = [[[UIView Alloc] Initwithframe:cgrectmake (+, +, +)] autorelease];
View.backgroundcolor = [Uicolor Redcolor];
//
Set the circle angle
View.layer.cornerRadius = 50;
//
[Self.window Addsubview:view];
Label
UILabel *label = [[[UILabel Alloc] Initwithframe:cgrectmake (+, +, +)] autorelease];
Label.text = @ "I am a label." I am a label. I am a label. I am a label. I am a label. I am a label. ";
Label.backgroundcolor = [Uicolor Graycolor];
//
Set the color of a font
Label.textcolor = [Uicolor colorwithred:0.1 green:0.2 blue:0.5 alpha:1.0f];
//
//
Set font size, default is 17th font
Label.font = [Uifont systemfontofsize:10.0f];
//
How to set the alignment
Label.textalignment = Nstextalignmentcenter;
//
Set Shadow Color
Label.shadowcolor = [Uicolor Yellowcolor];
//
Change the offset of the shadow
Label.shadowoffset = Cgsizemake (10, 10);
//
Set transparency
Label.alpha = 0.8;
//
Let the label wrap, if you do not know the label is exactly a few lines, set to 0
Label.numberoflines = 0;
//
//
Set the label to break
Label.linebreakmode = Nslinebreakbytruncatinghead;
[Self.window Addsubview:label];
Modified is bounds.
Self.window.bounds = CGRectMake (50, 50, 320, 480);
//
UIView *view = [[UIView alloc] Initwithframe:cgrectmake (0, 0, 100, 100)];
View.backgroundcolor = [Uicolor Bluecolor];
//
[Self.window Addsubview:view];
return YES;
}
-(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 This method to release the shared resources, save user data, invalidate timers, and store enough application state info Rmation 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 the User quits.
}
-(void) Applicationwillenterforeground: (uiapplication *) Application {
Called as part of the transition from the background to the inactive state; Here's can undo many of the changes made 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:.
}
@end
UIView and label