首页 > 移动平台 > 详细

iOS UI01_Label

时间:2015-07-30 09:33:22      阅读:244      评论:0      收藏:0      [点我收藏+]

@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=@"赵志程是个大好人,你们要好好对待他! ! !";

    //文本内容颜色

    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;

}技术分享


版权声明:本文为博主原创文章,未经博主允许不得转载。

iOS UI01_Label

原文:http://blog.csdn.net/cheng_xiansheng/article/details/47143529

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!