UILabel
来源:互联网 发布:宁波淘宝直播招聘 编辑:程序博客网 时间:2024/06/05 21:18
#import "AppDelegate.h"@interface AppDelegate ()@end@implementation AppDelegate- (void)dealloc{ // 对应属性里边那个strong(retain) [_window release]; [super dealloc];}- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.window.backgroundColor = [UIColor cyanColor]; [self.window makeKeyAndVisible]; [_window release]; // UILabel(标签) 是显示文本(在视图上显示文字)的控件 在App中是出现频率最高的控件 // 它是UIView的子类,扩展了文字显示的功能,它是能显示文字的视图 UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(100, 100, 100, 100)]; label.backgroundColor = [UIColor orangeColor]; [self.window addSubview:label]; [label release]; // 设置文本内容 label.text = @"天山童姥afgaj"; // 文本内容的颜色 label.textColor = [UIColor blackColor]; // 文本的对齐方式 label.textAlignment = NSTextAlignmentCenter; // 文本字体大小 font label.font = [UIFont systemFontOfSize:30]; label.font = [UIFont fontWithName:@"Helvetica-Bold" size:30]; // 黑体加粗 // 文本行数 // 设置行数 默认是一行,设置几行就是显示几行,注意label的高度要能容纳行数 // 如果行数没能显示完信息,没显示的信息以省略号代替 // 设置成0是行数的最大值 label.numberOfLines = 0; // 文本换行模式 以单词为单位换行 // 让文本自己去适应label的尺寸,显示全部内容 // 断行模式 label.lineBreakMode = NSLineBreakByTruncatingMiddle; // 文本阴影 // 阴影颜色// label.shadowColor = [UIColor redColor]; // 阴影大小 阴影向x正方向偏移2,向y正方向偏移10.// label.shadowOffset = CGSizeMake(2, 10); // 设置圆角和边框 label.layer.borderWidth = 1; // 幅度 label.layer.cornerRadius = 10; label.layer.masksToBounds = YES; label.frame = CGRectMake(100, 100, 200, 200); // center可以修改视图的位置 label.center = CGPointMake(100+75, 100+75); return YES;}@end
0 0
- UILabel
- UILabel
- UILabel
- UILabel
- UILabel
- UILabel
- UILabel
- UILabel
- UILabel
- UILabel
- UILabel
- UILabel
- UILabel
- UIlabel
- UILabel
- UILabel
- UILabel
- UILabel
- 8.5学习总结
- zoj 2100 Seeding
- Android Studio的使用
- hdu 1010 Tempter of the Bone
- 虚拟化项目之运维实践10
- UILabel
- 机器学习中的范数规则化之(二)核范数与规则项参数选择
- 20150805 oracle笔记
- leetcode 092 —— Reverse Linked List II
- UICollectionView基本使用方法
- Binary Tree Maximum Path Sum
- Java IO
- leetcode Merge Sorted Array
- 【暑期基础2】A HDU 2026 首字母变大写