UI_UILabel
2015-07-30 08:31
211 查看
#import "AppDelegate.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (void)dealloc
{
[_window release];
// 释放.h文件属性的retain
[super dealloc];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
[_window release];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(100,
100, 150,
150)];
label.backgroundColor = [UIColor cyanColor];
[self.window addSubview:label];
[label release];
//
设置文本内容
label.text =
@"吟游诗人
守护
法师
血袭";
//
文本字体的颜色
label.textColor = [UIColor whiteColor];
//
文本的对齐方式
label.textAlignment = NSTextAlignmentCenter;
//
字体大小
label.font = [UIFont systemFontOfSize:20];
//
设置行数
//
默认是一行
//
设置成0是行数的最大值
label.numberOfLines =
3;
//
让文本自己去适应label的尺寸,显示全部内容
// [label sizeToFit];
//
断行模式
label.lineBreakMode = NSLineBreakByTruncatingMiddle;
//
阴影大小
label.shadowOffset = CGSizeMake(2,
1);
//
阴影颜色
label.shadowColor = [UIColor blackColor];
//
设置圆角和边框
//
设置边框
label.layer.borderWidth =
1;
//
设置圆角
label.layer.cornerRadius =
30;
//
去除多余的部分
label.layer.masksToBounds =
YES;
// center可以修改视图的位置
// label.frame = CGRectMake(100, 100, 200, 200);
label.center = CGPointMake(100 +
75, 100 +
75);
return
YES;
}
@interface AppDelegate ()
@end
@implementation AppDelegate
- (void)dealloc
{
[_window release];
// 释放.h文件属性的retain
[super dealloc];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
[_window release];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(100,
100, 150,
150)];
label.backgroundColor = [UIColor cyanColor];
[self.window addSubview:label];
[label release];
//
设置文本内容
label.text =
@"吟游诗人
守护
法师
血袭";
//
文本字体的颜色
label.textColor = [UIColor whiteColor];
//
文本的对齐方式
label.textAlignment = NSTextAlignmentCenter;
//
字体大小
label.font = [UIFont systemFontOfSize:20];
//
设置行数
//
默认是一行
//
设置成0是行数的最大值
label.numberOfLines =
3;
//
让文本自己去适应label的尺寸,显示全部内容
// [label sizeToFit];
//
断行模式
label.lineBreakMode = NSLineBreakByTruncatingMiddle;
//
阴影大小
label.shadowOffset = CGSizeMake(2,
1);
//
阴影颜色
label.shadowColor = [UIColor blackColor];
//
设置圆角和边框
//
设置边框
label.layer.borderWidth =
1;
//
设置圆角
label.layer.cornerRadius =
30;
//
去除多余的部分
label.layer.masksToBounds =
YES;
// center可以修改视图的位置
// label.frame = CGRectMake(100, 100, 200, 200);
label.center = CGPointMake(100 +
75, 100 +
75);
return
YES;
}
相关文章推荐
- UI_UIView
- UIButtom及其常用的小控件
- Unique Paths
- Longest Common Subsequence Problem
- Java GUI图形界面开发工具
- Java GUI图形界面开发工具
- android学习笔记UI-ImageView
- 压缩Gradle构建 (Squeezing your Gradle builds)
- apue 第十二章 线程控制
- Criteria Query—Hibernate之面向对象查询
- Unique Binary Search Tree II ***
- 点评版:函数源代码 strcpy/memcpy/atoi/kmp/quicksort
- UGUI实现摇杆(模仿太极熊猫)
- IOS开发之UISearchBar应用
- apc220使用心得
- Ueditor1.4.3上传图片参照宽度或高度进行压缩(默认最长边)
- 【UI-基础】富文本
- Unique Binary Search Tree
- UI007---KVC
- android菜鸟笔记之UI线程阻塞