• ios学习记录 day23 UI 2


    UILabel:显示文本的控件(静态文本框,内容不能修改)

        UILabel * label1 = [[UILabel alloc] initWithFrame:CGRectMake(20, 20, 100, 60)];
        [label1 setBackgroundColor:[UIColor redColor]];
        label1.alpha = 0.5;
    //    label1.text = @"hello";//点语法的内部实现是set方法
        [label1 setText:@"hello world"];
        [label1 setTextColor:[UIColor blueColor]];
        
        //    UIFont * font = [UIFont systemFontOfSize:20];
        UIFont * boldfont = [UIFont boldSystemFontOfSize:25];//设置字体(加粗)
        [label1 setFont:boldfont];//设置字体
        
        [label1 setTextAlignment:NSTextAlignmentCenter];//对齐方式 0左对齐 1居中 2右对齐
        [label1 setNumberOfLines:0];//多行显示 0代表任意行数,根据文本内容匹配行数
        
        [label1 setShadowColor:[UIColor grayColor]];//阴影颜色
        [label1 setShadowOffset:CGSizeMake(-4, 6)];//阴影偏移 CGSizeMake(左右偏移,上下偏移)
        
        [self.window addSubview:label1];
        [label1 release];

    UITextField:单行文本输入框(控制文本输入和显示的控件)

    [textField setBorderStyle:UITextBorderStyleNone];//边框样式 UITextBorderStyleNone无边框, UITextBorderStyleLine线形, UITextBorderStyleBezel斜边, UITextBorderStyleRoundedRect圆角

    [textField setPlaceholder:@"你跟谁俩hello!"];//text内提示内容

    UIButton:按钮 响应用户点击的控件

    Button有三层:1.最底层View 可改背景==  2.表层左侧 图片(setimage) 3.表层右侧 文字(titleLable)

    //单击虚拟键盘退下去

    - (void)buttonAction
    {
        NSLog(@"%s",__func__);
        UITextField * text = (UITextField *)[self.window viewWithTag:TEXTFIELDTAG];//(UITextField *)强制转换类型
        [text resignFirstResponder];//重新定义text的第一响应者
    }

    UIAlertView:弹出框 是IOS中得提醒视图 一般是为了询问用户的下一步操作

    delegate//协议

  • 相关阅读:
    硬盘的结构和介绍,硬盘MBR详细介绍(超详细彩图)
    websocket协议学习
    Qt4可以使用trUtf8函数,其内容可以是中文,也可以是F硬编码
    QString转换为LPTSTR(使用了reinterpret_cast,真是叹为观止,但是也开阔了思路),三篇文章合起来的各种转换方法
    系统高可用
    Visual Studio
    管道是如何建立起来的?
    CLR和.Net对象
    任务调度
    路由与控制器
  • 原文地址:https://www.cnblogs.com/lxllanou/p/3641623.html
Copyright © 2020-2023  润新知