简单的ui优化界面

#import "AppDelegate.h"

//定义枚举值 -- 用来区分用户名好密码输入框
typedef enum : NSUInteger {
    YHMNameTag = 101,
    MMNameTag,
    ZCYHMNameTag ,
    ZCMMNameTag,
    ZCQRMMNameTag,
    ZCSJHNameTag,
    ZCYXNameTag,
    ZHMMYXNameTag,
    
} tagTag;

@interface AppDelegate ()<UITextFieldDelegate>

@property (nonatomic,strong)UIView *dengLu;
@property (nonatomic,strong)UIView *zhuCe;
@property (nonatomic,strong)UIView *zhaoHui;
@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    
    //创建画板
    self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];

//注册
    self.zhuCe = [[UIView alloc]initWithFrame:[UIScreen mainScreen].bounds];
    self.zhuCe.backgroundColor = [UIColor whiteColor];
    [self.window addSubview: self.zhuCe];
    
    //找回
    self.zhaoHui = [[UIView alloc]initWithFrame:[UIScreen mainScreen].bounds];
    self.zhaoHui.backgroundColor = [UIColor whiteColor];
    [self.window addSubview:self.zhaoHui];
    
    //登陆
    self.dengLu = [[UIView alloc]initWithFrame:[UIScreen mainScreen].bounds];
    self.dengLu.backgroundColor = [UIColor whiteColor];
    [self.window addSubview:self.dengLu];

//调用布局登陆页面的方法
    [self setUpdengLuView];
    
    //调用布局注册页面的方法
    [self setUpZhuCeView];
 
    //调用布局找回密码的方法
    [self setUpZhaoHuiMiMaView];

return YES;
}

#pragma mark  登陆界面
//登陆界面
- (void)setUpdengLuView{
    
    //用户名
    UILabel *labelDL = [[UILabel alloc]initWithFrame:CGRectMake(50, 100, 80, 40)];
    labelDL.backgroundColor = [UIColor whiteColor];
    labelDL.text  = @"用户名";
    [self.dengLu addSubview:labelDL];
    
    //用户名输入
    UITextField *textFieldYHM = [[UITextField alloc]initWithFrame:CGRectMake(CGRectGetMaxX(labelDL.frame)  , CGRectGetMinY(labelDL.frame), 200, 40)];
    textFieldYHM.placeholder = @"请输入用户名";
    textFieldYHM.borderStyle = 3;//把输入框改为圆的
    textFieldYHM.clearButtonMode = 1;//设置删除
    textFieldYHM.returnKeyType = UIReturnKeyNext;//吧return换成nest
    textFieldYHM.delegate = self;//代理
    textFieldYHM.tag = YHMNameTag;//设置YHMNameTag的值
    [self.dengLu addSubview:textFieldYHM];
    
    //密码
    UILabel *labelMM = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMinX(labelDL.frame), CGRectGetMaxY(labelDL.frame) + 10, 80, 40)];
    labelMM.backgroundColor = [UIColor whiteColor];
    labelMM.text = @"密码";
    [self.dengLu addSubview:labelMM];
    
    //密码输入
    UITextField *textFieldMM = [[UITextField alloc]initWithFrame:CGRectMake(CGRectGetMinX(textFieldYHM.frame) , CGRectGetMaxY(textFieldYHM.frame) + 10, 200, 40)];
    textFieldMM.placeholder = @"请输入密码";
    textFieldMM.clearButtonMode = 1;
    textFieldMM.secureTextEntry = 1;//安全密码
    textFieldMM.borderStyle = 3;
    textFieldMM.delegate = self;
    textFieldMM.tag = MMNameTag;
    [self.dengLu addSubview:textFieldMM];
    
    
    //登录
    UIButton *buttonDL = [UIButton buttonWithType:UIButtonTypeSystem];
    buttonDL.frame = CGRectMake(CGRectGetMinX(labelMM.frame) , CGRectGetMaxY(labelMM.frame) + 20, 50, 50);
    [buttonDL setTitle:@"登录" forState:UIControlStateNormal];
    [buttonDL setTitleColor:[UIColor greenColor] forState:UIControlStateNormal];//设置字体颜色
    buttonDL.titleLabel.font = [UIFont systemFontOfSize:17.0];//设置字体
    [self.dengLu addSubview:buttonDL];
    [buttonDL addTarget:self action:@selector(DLDidClicked:) forControlEvents:UIControlEventTouchUpInside];//绑定
    
    
        
    
    
    
    
    //找回密码
    UIButton *buttonZHMM = [UIButton buttonWithType:UIButtonTypeSystem];
    buttonZHMM.frame = CGRectMake(CGRectGetMaxX(buttonDL.frame), CGRectGetMinY(buttonDL.frame), 120, 50);
    [buttonZHMM setTitle:@"找回密码" forState:UIControlStateNormal];
    [buttonZHMM setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    buttonZHMM.titleLabel.font = [UIFont systemFontOfSize:17.0];
    [self.dengLu addSubview:buttonZHMM];
    [buttonZHMM addTarget:self action:@selector(ZHMMDidClicked:) forControlEvents:UIControlEventTouchUpInside];//绑定
    
    
    //注册
    UIButton *buttonZC = [UIButton buttonWithType:UIButtonTypeSystem];
    buttonZC.frame = CGRectMake(CGRectGetMaxX(buttonZHMM.frame) + 20, CGRectGetMinY(buttonZHMM.frame), 50, 50);
    [buttonZC setTitle:@"注册" forState:UIControlStateNormal];
    [buttonZC setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
    buttonZC.titleLabel.font = [UIFont systemFontOfSize:17.0];
    [self.dengLu addSubview:buttonZC];
    [buttonZC addTarget:self action:@selector(ZCDidClicked:) forControlEvents:UIControlEventTouchUpInside];//绑定
}

//次方法只要用来回收键盘
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    UITextField *YHM = (UITextField *)[self.dengLu viewWithTag:YHMNameTag];
    UITextField *MM = (UITextField *)[self.dengLu viewWithTag:MMNameTag];
    UITextField *ZCYHM = (UITextField *)[self.zhuCe viewWithTag:ZCYHMNameTag];
    UITextField *ZCMM = (UITextField *)[self.zhuCe viewWithTag:ZCMMNameTag];
    UITextField *ZCQRMM = (UITextField *)[self.zhuCe viewWithTag:ZCQRMMNameTag];
    UITextField *ZCSJH = (UITextField *)[self.zhuCe viewWithTag:ZCSJHNameTag];
    UITextField *ZCYX = (UITextField *)[self.zhuCe viewWithTag:ZCYXNameTag];
  //  UITextField *ZHMMYX = (UITextField *)[self.zhaoHui viewWithTag:ZHMMYXNameTag];
    if (textField.tag == YHMNameTag) {
        //撤销用户名输入框的第一响应者
        [YHM resignFirstResponder];
        //让密码输入框变成第一响应者
        [MM becomeFirstResponder];

}else{
        //回收键盘
        [textField resignFirstResponder];

}
  //  return YES;
    
    
    if (textField.tag == ZCYHMNameTag) {
        [ZCYHM resignFirstResponder ];
        [ZCMM becomeFirstResponder];
    } else if (textField.tag == ZCMMNameTag){
        [ZCMM resignFirstResponder];
        [ZCQRMM becomeFirstResponder];
    } else if (textField.tag == ZCQRMMNameTag){
        [ZCQRMM resignFirstResponder];
        [ZCSJH becomeFirstResponder];
    } else if (textField.tag == ZCSJHNameTag){
        [ZCSJH resignFirstResponder];
        [ZCYX becomeFirstResponder];
    } else{
        [textField resignFirstResponder];
    }
    
    return YES;
    
    
    
    
    
    
    
    
}

#pragma mark 注册界面
//注册界面
- (void)setUpZhuCeView{
    
    //用户名
    UILabel *labelZCYHM = [[UILabel alloc]initWithFrame:CGRectMake(50, 80, 80, 40)];
    labelZCYHM.backgroundColor = [UIColor whiteColor];
    labelZCYHM.text = @"用户名";
    [self.zhuCe addSubview:labelZCYHM];
    
    //请输入用户名
    UITextField *textFieldZCSRYHM = [[UITextField alloc]initWithFrame:CGRectMake(CGRectGetMaxX(labelZCYHM.frame) + 10, CGRectGetMinY(labelZCYHM.frame), 180, 40)];
    textFieldZCSRYHM.placeholder = @"请输入用户名";
    textFieldZCSRYHM.borderStyle = 3;
    textFieldZCSRYHM.clearButtonMode = 1;
    textFieldZCSRYHM.returnKeyType = UIReturnKeyNext;//把return换成nest
    textFieldZCSRYHM.delegate = self;//设置代理
    [self.zhuCe addSubview:textFieldZCSRYHM];
    textFieldZCSRYHM.tag =ZCYHMNameTag;
    
    //密码
    UILabel *labelZCMM = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMinX(labelZCYHM.frame), CGRectGetMaxY(labelZCYHM.frame) + 10, 80, 40)];
    labelZCMM.text = @"密码";
    labelZCMM.backgroundColor = [UIColor whiteColor];
    [self.zhuCe addSubview:labelZCMM];
    
    
    //请输入密码
    UITextField *textFieldSRMM = [[UITextField alloc]initWithFrame:CGRectMake(CGRectGetMinX(textFieldZCSRYHM.frame), CGRectGetMaxY(textFieldZCSRYHM.frame) + 10, 180, 40)];
    textFieldSRMM.placeholder = @"请输入密码";
    textFieldSRMM.clearButtonMode = 1;
    textFieldSRMM.secureTextEntry = 1;//安全输入
    textFieldSRMM.borderStyle = 3;//圆形输入框
    [self.zhuCe addSubview:textFieldSRMM];
    textFieldSRMM.delegate = self;
    textFieldSRMM.returnKeyType = UIReturnKeyNext;
    textFieldSRMM.tag = ZCMMNameTag;
    
    //确认密码
    UILabel *labelZCQRMM = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMinX(labelZCMM.frame), CGRectGetMaxY(labelZCMM.frame) + 10, 80, 40)];
    labelZCQRMM.text = @"确认密码";
    labelZCQRMM.backgroundColor = [UIColor whiteColor];
    [self.zhuCe addSubview:labelZCQRMM];
    
    //再次输入密码
    UITextField *textFieldZCQRMM = [[UITextField alloc]initWithFrame:CGRectMake(CGRectGetMinX(textFieldSRMM.frame), CGRectGetMaxY(textFieldSRMM.frame) + 10, 180, 40)];
    textFieldZCQRMM.placeholder = @"再次输入密码";
    textFieldZCQRMM.clearButtonMode = 1;
    textFieldZCQRMM.secureTextEntry = 1;
    textFieldZCQRMM.borderStyle = 3;
    [self.zhuCe addSubview:textFieldZCQRMM];
    textFieldZCQRMM.delegate = self;
    textFieldZCQRMM.returnKeyType = UIReturnKeyNext;
    textFieldZCQRMM.tag = ZCQRMMNameTag;
    
    //手机号
    UILabel *labelZCSJH = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMinX(labelZCQRMM.frame), CGRectGetMaxY(labelZCQRMM.frame) + 10, 80, 40)];
    labelZCSJH.text = @"手机号";
    labelZCSJH.backgroundColor = [UIColor whiteColor];
    [self.zhuCe addSubview:labelZCSJH];
    
    //请输入手机号
    UITextField *textFieldSRSJH = [[UITextField alloc]initWithFrame:CGRectMake(CGRectGetMinX(textFieldZCQRMM.frame), CGRectGetMaxY(textFieldZCQRMM.frame) + 10, 180, 40)];
    textFieldSRSJH.placeholder = @"请输入手机号";
    textFieldSRSJH.clearButtonMode = 1;
   textFieldSRSJH.borderStyle = 3;
   // textFieldSRSJH.keyboardType = UIKeyboardTypeNumberPad;
    [self.zhuCe addSubview:textFieldSRSJH];
    textFieldSRSJH.delegate = self;
    textFieldSRSJH.returnKeyType = UIReturnKeyNext;
    textFieldSRSJH.tag = ZCSJHNameTag;
    
    //邮箱
    UILabel *labelZCYX = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMinX(labelZCSJH.frame), CGRectGetMaxY(labelZCSJH.frame) + 10, 80, 40)];
    labelZCYX.text = @"邮箱";
    labelZCYX.backgroundColor = [UIColor whiteColor];
    [self.zhuCe addSubview:labelZCYX];
    
    //请输入邮箱
    UITextField *textFieldSRYX = [[UITextField alloc]initWithFrame:CGRectMake(CGRectGetMinX(textFieldSRSJH.frame), CGRectGetMaxY(textFieldSRSJH.frame) + 10, 180, 40)];
    textFieldSRYX.placeholder = @"请输入邮箱";
    textFieldSRYX.clearButtonMode = 1;
    textFieldSRYX.borderStyle = 3;
    textFieldSRYX.keyboardType = 2;//邮箱的键盘
    [self.zhuCe addSubview:textFieldSRYX];
    textFieldSRYX.delegate = self;
    textFieldSRYX.returnKeyType = UIReturnKeyNext;
    textFieldSRYX.tag = ZCYXNameTag;
    
    //注册
    UIButton *buttonZCZC = [UIButton buttonWithType:UIButtonTypeSystem];
    buttonZCZC.frame = CGRectMake(CGRectGetMinX(labelZCYX.frame) + 20, CGRectGetMaxY(labelZCYX.frame) + 10, 50, 50);
    [buttonZCZC setTitle:@"注册" forState:UIControlStateNormal];
    [self.zhuCe addSubview:buttonZCZC];
    [buttonZCZC addTarget:self action:@selector(ZCZC:) forControlEvents:UIControlEventTouchUpInside];
    
    //取消
    UIButton *buttonZCQX = [UIButton buttonWithType:UIButtonTypeSystem];
    buttonZCQX.frame = CGRectMake(CGRectGetMaxX(buttonZCZC.frame) + 100, CGRectGetMinY(buttonZCZC.frame), 50, 50);
    [buttonZCQX setTitle:@"取消" forState:UIControlStateNormal];
    [self.zhuCe addSubview:buttonZCQX];
    [buttonZCQX addTarget:self action:@selector(QXFanhuizhujiemian:) forControlEvents:UIControlEventTouchUpInside];
    
    
}

#pragma mark 找回密码界面
- (void)setUpZhaoHuiMiMaView{
    
    
    UITextField *textFieldDZYX = [[UITextField alloc]initWithFrame:CGRectMake(80, 120, 215, 50)];
    textFieldDZYX.placeholder = @"电子邮箱";
    textFieldDZYX.clearButtonMode = 1;
    textFieldDZYX.borderStyle = 3;
    textFieldDZYX.keyboardType = 2;
    //textFieldDZYX.font = [UIFont systemFontOfSize:25.0];
    [self.zhaoHui addSubview:textFieldDZYX];
    textFieldDZYX.delegate = self;//代理。。回收键盘
    textFieldDZYX.tag = ZHMMYXNameTag;
    //找回
    UIButton *buttonZH = [UIButton buttonWithType:UIButtonTypeSystem];
    buttonZH.frame = CGRectMake(CGRectGetMinX(textFieldDZYX.frame), CGRectGetMaxY (textFieldDZYX.frame) + 20, 50, 50);
    [buttonZH setTitle:@"找回" forState:UIControlStateNormal];
    [self.zhaoHui addSubview:buttonZH];
    [buttonZH addTarget:self action:@selector(zhaoHui:) forControlEvents:UIControlEventTouchUpInside];
    
    //取消
    UIButton *buttonQX = [UIButton buttonWithType:UIButtonTypeSystem];
    buttonQX.frame = CGRectMake(CGRectGetMaxX(buttonZH.frame) + 100, CGRectGetMinY(buttonZH.frame), 50, 50);
    [buttonQX setTitle:@"取消" forState:UIControlStateNormal];
    [self.zhaoHui addSubview:buttonQX];
    [buttonQX addTarget:self action:@selector(QXFanhuizhujiemian:) forControlEvents:UIControlEventTouchUpInside];//绑定
    
    
}

#pragma mark 布局登陆界面
- (void)DLDidClicked:(UIButton *)sender{
    UITextField *YHM = (UITextField *)[self.dengLu viewWithTag:YHMNameTag];
    UITextField *MM = (UITextField *)[self.dengLu viewWithTag:MMNameTag];
    if ([YHM.text isEqual:@""] || [MM.text isEqual:@""] ) {
        
    UIAlertView *filed = [[UIAlertView alloc] initWithTitle:@"提示" message:@"用户名或密码不能为空,请核对后重试" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
    [filed show];
    } else if ([MM.text isEqual:@"321"] && [YHM.text isEqual:@"321"] ){
        UIAlertView *filed = [[UIAlertView alloc] initWithTitle:@"提示" message:@"登录成功" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
        [filed show];
       }
     else{
        UIAlertView *filed = [[UIAlertView alloc] initWithTitle:@"提示" message:@"用户名或密码不正确" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
        [filed show];
        
    }
    
}

#pragma mark 登陆中的找回密码
- (void)zhaoHui:(UIButton *)sender{
    
    UITextField *ZHMMYX = (UITextField *)[self.zhaoHui viewWithTag:ZHMMYXNameTag];
    if ([ZHMMYX.text isEqualToString:@"[email protected]"]) {
        
    
    UIAlertView *filed1 = [[UIAlertView alloc]initWithTitle:@"提示" message:@"找回成功 " delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
        [filed1 show];
    
    } else{
    
    UIAlertView *filed2 = [[UIAlertView alloc]initWithTitle:@"提示" message:@"找回失败。" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定",nil];
    [filed2 show];
    }

}

#pragma mark 布局找回密码页面
- (void)ZHMMDidClicked:(UIButton *)sender{
   
    self.dengLu.hidden = YES;
    self.zhaoHui.hidden = NO;
    
}

#pragma mark 布局注册页面
- (void)ZCDidClicked:(UIButton *)sender{

self.dengLu.hidden = YES;
    self.zhaoHui.hidden = YES;
    self.zhuCe.hidden = NO;
}
#pragma mark 取消返回主界面
- (void)QXFanhuizhujiemian:(UIButton *)sender{
    self.dengLu.hidden = NO;
    self.zhaoHui.hidden = YES;
    
}

#pragma mark 注册中的注册情况
- (void)ZCZC:(UIButton *)sender{
    UITextField *ZCYHM = (UITextField *)[self.zhuCe viewWithTag:ZCYHMNameTag];
    UITextField *ZCMM = (UITextField *)[self.zhuCe viewWithTag:ZCMMNameTag];
    UITextField *ZCQRMM = (UITextField *)[self.zhuCe viewWithTag:ZCQRMMNameTag];
    UITextField *ZCSJH = (UITextField *)[self.zhuCe viewWithTag:ZCSJHNameTag];
    UITextField *ZCYX = (UITextField *)[self.zhuCe viewWithTag:ZCYXNameTag];
    
    if ([ZCYHM.text isEqual:@""] || [ZCMM.text isEqual:@""] || [ZCQRMM.text isEqual:@""]) {
        UIAlertView *field = [[UIAlertView alloc]initWithTitle:@"提示" message:@"用户名或密码或确认密码 不能为空" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定 ", nil];
        [field show];
    } else if ([ZCMM.text isEqualToString:ZCQRMM.text] == 0){
        UIAlertView *field = [[UIAlertView alloc]initWithTitle:@"提示" message:@"注密码不一致,请重新输入" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定 ", nil];
        [field show];
        
    } else if ([ZCSJH.text isEqual:@"153****23"] && [ZCYX.text isEqual:@"[email protected]"]){
    UIAlertView *field = [[UIAlertView alloc]initWithTitle:@"提示" message:@"注册成功" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定 ", nil];
        [field show];
    } else{
        
        UIAlertView *field = [[UIAlertView alloc]initWithTitle:@"提示" message:@"注册失败" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定 ", nil];
        [field show];
    }
    
    
    
    
}

时间: 2024-10-14 13:08:28

简单的ui优化界面的相关文章

android产品研发(二十一)--&gt;UI优化

转载请标明出处:一片枫叶的专栏 上一篇文章中我们讲解了android产品研发过程中的代码Review.通过代码Review能够提高产品质量,增强团队成员之间的沟通,提高开发效率,所以良好的产品开发迭代过程中,代码Review是一个必不可少的步骤.那么如何进行代码Review呢?我们主要讲解了团队成员之间的代码Review,代码lint检查,开发规范等方面的知识点,更多关于代码Review相关的知识可参考我的:android产品研发(二十)–>代码Review 本文我们将讲解一下android U

[安卓基础] 005.创建一个简单的UI

*:first-child { margin-top: 0 !important; } body > *:last-child { margin-bottom: 0 !important; } a { color: #4183C4; text-decoration: none; } a.absent { color: #cc0000; } a.anchor { display: block; padding-left: 30px; margin-left: -30px; cursor: poin

Unreal SDK 游戏开发从入门到精通(UnrealScript语法、UI Scene界面、UDK独立开发游戏)

对这个课程有兴趣的朋友可以加我的QQ2059055336和我联系 课程内容简介 本系列讲座主要讲述如何利用UDK开发游戏程序. 本课程主要分为四个部分: 1.学习UnrealScript的基本语法, 为下面的学习打下良好的基础 2.系统学习UDK的主要模块, 熟悉并掌握游戏开发的各个系统 3.使用UDK独立开发游戏Demo, 体验和理解UDK对游戏开发流程的整合 课程大纲 第一章初步接触Unreal SDK 1.1 Unreal sdk简介aaa 1.2 UC语言的基本介绍 1.3 搭建UDK的

Android学习路线(四)构建一个简单的UI

Android应用的图形化用户界面的构建使用的是View 和 ViewGroup 对象的层次嵌套. View 对象通常是UI部件,例如 buttons 或者 text fields ,而 ViewGroup 是用来定义它的子布局如何排布的容器,它通常是不可见的,例如一个网格或者一个垂直的列表. Android提供XML词汇与View或者ViewGroup的子类的对应,这样的话你就可以通过XML元素的层级嵌套来定义你的UI. 另一种布局 使用XML声明UI比在运行时代码中声明更有用处可以在很多地方

谷歌眼镜Mirror app简单MP3播放器界面

虽然我知道,Mirror是不可以播放音视频的 = =!,不过只是做个UI而已,有用的可以参考下-(背景:歌手|标题:歌名|中间:歌词[蓝色显示目前]|底部:时间[黄色显示播放时间]) 效果图: 代码: 1 <article> 2 <img src="http://img2.imgtn.bdimg.com/it/u=394713825,2736623939&fm=23&gp=0.jpg" width="100%"> 3 <

Redis Admin UI——一个Redis UI管理界面

Redis Admin UI--一个Redis UI管理界面 Redis的管理UI是由两部分组成: 1.An Ajax客户端的Web应用程序(基于谷歌的闭合库开发的:https://github.com/google/closure-library),它作为一个简单的静态HTML/ JS/ CSS的应用程序,可以很容易地修改,并从服务器组件分离和托管任何静态HTTP文件服务器上. 2.一个ServiceStack http://www.servicestack.net/ ASP.NET Web服

数据库5.5.32编译安装和简单的初步优化

.数据库5.5.32编译安装和简单的初步优化 1.环境: [[email protected] sbin]# cat/etc/redhat-release CentOS release 6.6 (Final) Ip:外网:10.0.0.31  内网:172.16.1.31 2.安装步奏: Useradd mysql -s /sbin/nologin -M Id mysql yum install cmake -y yum install libaio-develncurses-devel -y

JS代码的简单重构与优化

JS代码的简单重构与优化(适合新手) 原文  http://www.cnblogs.com/similar/p/5016424.html Demo . 1 //bad if (age > 20) { return true; } else { return false; } //good return age > 20; 这种一看就明白吧,没什么说的. Demo . 2 //bad for (var i = 0; i < arr.length; i++) { //do something

简单模仿QQ聊天界面

首先看一下最终的效果,显示了消息时间,用户昵称,用户头像. 大致实现方法: 用最简单的ListView显示消息内容. 不同的用户使用不同的消息布局文件,例子有2个用户"Tony","Hill". 代码文件清单: 主布局文件activity_main.xml: 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 xmlns:tools=&