今天來完成一個(gè)簡單的QQ的登錄界面互例。
首先我們需要看一下QQ在登錄啟動(dòng)時(shí)的界面是個(gè)什么樣的效果奢入。
在QQ剛啟動(dòng)時(shí)會(huì)展示上圖的一個(gè)啟動(dòng)圖的效果,然后展示下圖需要輸入賬號(hào)和密碼的界面媳叨。下面來開始創(chuàng)建一個(gè)工程進(jìn)行搭建腥光。
在顯示的界面中有一個(gè)image,3個(gè)Button糊秆,兩份Text武福。
把各個(gè)空間拖進(jìn)view中,修改每一個(gè)控件的屬性扩然。
然后給登錄按鈕添加單擊事件艘儒。
// ViewController.m
// QQ userInterface
//
// Created by 袁躍 on 16/4/24.
// Copyright ? 2016年 iflytek. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
- (IBAction)login;
@property (weak, nonatomic) IBOutlet UITextField *txtQQ;
@property (weak, nonatomic) IBOutlet UITextField *txtPassword;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)login {
NSString* txtQQ = self.txtQQ.text;
NSString* txtpsw = self.txtPassword.text;
NSLog(@"QQ:%@ 密碼:%@",txtQQ,txtpsw);
[self.view endEditing:YES];
}
@end
這就搭建好了一個(gè)簡單的QQ的登錄界面。效果如下