您的位置:首页 > 产品设计 > UI/UE

iOS UI01_Label

2015-07-30 08:49 302 查看
@implementation AppDelegate
-(void)dealloc
{

[_window
release];
[superdealloc];
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary
*)launchOptions {

self.window = [[UIWindowalloc]initWithFrame:[[UIScreenmainScreen]bounds]];

// Override point for customization after application launch.

self.window.backgroundColor = [UIColorwhiteColor];

[self.windowmakeKeyAndVisible];

[_window
release];

//UILabel显示文本内容

UILabel *label=[[UILabelalloc]initWithFrame:CGRectMake(100,
100, 200, 150)];

label.backgroundColor=[UIColorcyanColor];

[self.windowaddSubview:label];
[labelrelease];

//
设置文本内容

label.text=@"学习iOS! ! !";

//文本内容颜色

label.textColor=[UIColoryellowColor];

//文本对齐方式

label.textAlignment=NSTextAlignmentCenter;

//
字体大小

label.font=[UIFontsystemFontOfSize:25];

//
设置行数

// 0是行数的最大值
label.numberOfLines=3;

//让文本自己去适应尺寸

// [label sizeToFit];

//断行模式

label.lineBreakMode=NSLineBreakByTruncatingMiddle;

//阴影颜色

label.shadowColor=[UIColorredColor];

//阴影大小

label.shadowOffset=CGSizeMake(2, 1);

//设置边框

label.layer.borderWidth=1;

//设置圆角

label.layer.cornerRadius=100;

label.layer.masksToBounds=YES;

//
中心点的位置 center可以修改视图的位置 frame可以修改尺寸
label.frame=CGRectMake(100, 100, 200, 200);
label.center =CGPointMake(200, 200);

return
YES;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: