UI2_UILabel
2015-10-20 20:30
441 查看
import “AppDelegate.h”
@interface AppDelegate ()@end
@implementation AppDelegate
- (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** UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(100, 100, 150, 50)]; label.backgroundColor = [UIColor yellowColor]; [self.window addSubview:label]; [label release]; // 能显示文本内容 label.text = @"测试一下,aaaa.aafjskwevdsfcds的的的的的fc的"; // 给label加上一个边框,并且给它加上一个弧度 label.layer.borderWidth = 1; label.layer.cornerRadius = 10; *隐藏多余部分* // 让label多余的部分隐藏掉 label.layer.masksToBounds = YES; // 修改字体大小 label.font = [UIFont systemFontOfSize:25]; // 修改文字颜色 label.textColor = [NSColor cyanColor]; // 对齐方式 label.textAlignment = NSTextAlignmentCenter; // 设置行数 label.numberOfLines = NSIntegerMax; // 可以自动适应文本内容 [label sizeToFit]; // 阴影颜色和大小 label.shadowColor = [UIColor redColor]; label.shadowOffset = CGSizeMake(2, 2); label.center = CGPointMake(100, 100); return YES; }
相关文章推荐
- 用xib定义UITableViewCell
- UI - UIViewAnimationAndCoreAnimation
- UI - GCD
- Qt for iOS:设置状态栏颜色(Quick)
- UI - NSThread
- UI - UICollectionView
- UINavigationController总结
- Map、Set、List、Queue、Stack的特点与用法1
- hdoj Equivalent Sets 3836 (强连通分量 最少添加几条边使图强连通)
- 安卓UI自适应性
- WPF、WinForm(C#)多线程编程并更新界面(UI)
- GT and sequence(bc模拟题)
- UI02_UIButton
- MiniUI中DataGrid数据的载入
- 【开发工具】分布式编译-IncrediBuild
- UEFI BIOS和 传统BIOS 启动模式对比
- TableLayout(表格布局)
- Android酷炫实用的开源框架(UI框架)
- UICollectionView
- request.getParameter("参数") 乱码问题