zoukankan      html  css  js  c++  java
  • 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//协议

  • 相关阅读:
    HRBUST 1377 金明的预算【DP】
    POJ 1745 Divisibility【DP】
    HRBUST 1476 教主们毕业设计排版==算法导论上的思考题整齐打印
    HRBUST 1220 过河【DP+状态】
    HRBUST 1478 最长公共子序列的最小字典序
    HRBUST 1162 魔女【DP】
    HDU 1561The more, The Better【DP】
    HRBUST 1376 能量项链【DP】
    POJ 1934 Trip【最长公共子序列输出】
    上传图片代码总结
  • 原文地址:https://www.cnblogs.com/lxllanou/p/3641623.html
Copyright © 2011-2022 走看看