1.label它是一个用来显示文本的控件 它是UIView的子类
//下面了开始对label的属性作设置
alabel.backgroundColor = [UIColorredColor];
//text属性是给label添加显示文字
alabel.text = @" your supportsadafafff background execution, this method is called instead of applicationWillTerminate: when the user quits.";
//设置文字对齐方式
// alabel.textAlignment = NSTextAlignmentCenter;
//设置label的字体
alabel.font = [UIFontsystemFontOfSize:20];
//设置字体颜色
alabel.textColor = [UIColorredColor];
//社之文本颜色
alabel.textColor = [UIColorwhiteColor];
//社值label可以显示的行数
alabel.numberOfLines = 0;//0不限制行数;
alabel.adjustsFontSizeToFitWidth = YES;//该属性是控制字体的大小来适应label的深度,保证文字完整显示。
//设置换行模式
//设置阴影
alabel.lineBreakMode = NSLineBreakByWordWrapping;
alabel.shadowOffset = CGSizeMake(10, 0) ;
alabel.shadowColor = [UIColorblueColor]
[self.window addSubview: alabel];//将label添加到窗口上
[alabel release];//因为是手动管理内存,对应初始化的alloc所以要release
2.UITextFiled 是一个显示文本,并可以输入的文本框的控件 它是UICotrol的子类 和UIButton一样都可以添加事件响应 ,但一般很少对其添加。
UITextField * atextField = [[UITextFieldalloc]initWithFrame:CGRectMake(20, 200, 280, 40)];
//社值textfiled的外观
atextField.backgroundColor = [UIColorwhiteColor];
//atextField.borderStyle = UITextBorderStyleNone;
atextField.borderStyle = UITextBorderStyleBezel;
//设置默认提示文字
atextField.placeholder = @"请输入文字信息";
atextField.keyboardAppearance = UIKeyboardAppearanceDark;
atextField.Tag =123;//tag是view的属性,可以通过viewWithTag:123找到该view
//也可以在原有文字上编辑
//设置键盘样式
// atextField.keyboardType = UIKeyboardTypeNumberPad;
atextField.keyboardType = UIKeyboardTypeURL;
//设置是否首字母大写。
atextField.autocapitalizationType = UITextAutocapitalizationTypeNone;
//将输入框添加到窗口上
[self.window addSubview:atextField];
[atextField release];
//设置编辑时清空已输入的内容
atextField.clearsOnBeginEditing = YES;
//设置右边的清空按钮
atextField.clearButtonMode = UITextFieldViewModeAlways;
//给textFiled对象设置代理对象,辅助textFiled来完成操作
atextField.delegate = self;
3.
//输入框的视图设置
atextField.inputAccessoryView = greenView;//给输入框添加输入附加视图(即在输入视图(默认键盘视图)的上面)
[greenView release];
[_titleLabel release];
//设置输入框的输入视图默认是键盘
// UIView *_blueView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 216)];
// _blueView.backgroundColor =[UIColor blueColor];
// // atextField.inputView = _blueView;
// [_blueView release];