iOS--APP 登錄界面圖(xuer)

来源:http://www.cnblogs.com/bolin-123/archive/2016/03/07/5252030.html
-Advertisement-
Play Games

ViewController.h #import "ViewController.h" @interface ViewController () @property(strong,nonatomic)UIImageView *beijing; @property(strong,nonatomic)


ViewController.h 


 

#import "ViewController.h"

@interface ViewController ()

@property(strong,nonatomic)UIImageView *beijing;
@property(strong,nonatomic) UIImageView *welcome;
@property(strong,nonatomic) UIImageView *phoneIcon;
@property(strong,nonatomic)UITextField *Intele;
@property(strong,nonatomic) UIView *InteleView;
@property(strong,nonatomic) UIImageView *passwordIcon;
@property(strong,nonatomic) UITextField *Inpassword;
@property(strong,nonatomic) UIView *InpasswordView;
@property(strong,nonatomic) UIImageView *logo;
@property(strong,nonatomic) UIButton *loginButton;
@property(strong,nonatomic) UIButton *rigisterButton;

@end

 

ViewController.m


@implementation ViewController

- (void)viewDidLoad {
        [super viewDidLoad];
    // 添加父視圖beijing背景圖
    self.beijing=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    //  插入圖片
    [self.beijing setImage:[UIImage imageNamed:@"beijing"]];
    [self.view addSubview:self.beijing];
    
    //  添加子視圖welcome背景圖
    self.welcome=[[UIImageView alloc] initWithFrame:CGRectMake(57, 36, 318, 58)];
    //  插入圖片
    [self.welcome setImage:[UIImage imageNamed:@"welcome"]];
    //  插入子視圖
    [self.view addSubview:self.welcome];
    
    
    // 添加phoneIcon輸入圖標
    self.phoneIcon=[[UIImageView alloc] initWithFrame:CGRectMake(66, 122, 25, 30)];
    //  插入圖片
    [self.phoneIcon setImage:[UIImage imageNamed:@"phoneIcon"]];
    [self.view addSubview:self.phoneIcon];
    
    // 添加手機號碼輸入框
    self.Intele=[[UITextField alloc] initWithFrame:CGRectMake(99, 122, 267, 40)];
    // 設置隱身字
    self.Intele.placeholder=@"請輸入手機號碼";
    //  設置數字彈出鍵盤
    self.Intele.keyboardType=UIKeyboardTypeNumberPad;
    // 設置無邊框的UITextField
    self.Intele.borderStyle=UITextBorderStyleNone;
    [self.view addSubview:self.Intele];
    self.InteleView=[[UIView alloc] initWithFrame:CGRectMake(66, 160, 300, 1)];
    self.InteleView.backgroundColor=[UIColor whiteColor];
    [self.view addSubview:self.InteleView];
    
    
    // 添加密碼輸入框
    self.Inpassword=[[UITextField alloc] initWithFrame:CGRectMake(99, 182, 267, 40)];
    self.Inpassword.placeholder=@"請輸入密碼";
    self.Inpassword.secureTextEntry=YES;
    self.Inpassword.borderStyle=UITextBorderStyleNone;
    [self.view addSubview:self.Inpassword];
    
    self.InpasswordView=[[UIView alloc] initWithFrame:CGRectMake(66, 213, 300, 1)];
    self.InpasswordView.backgroundColor=[UIColor whiteColor];
    [self.view addSubview:self.InpasswordView];
    
    // 添加passwordIcon輸入圖標
    self.passwordIcon=[[UIImageView alloc] initWithFrame:CGRectMake(66, 182, 25, 30)];
    [self.passwordIcon setImage:[UIImage imageNamed:@"passwordIcon"]];
    [self.view addSubview:self.passwordIcon];
    
    //  添加logo背景圖
    self.logo=[[UIImageView alloc] initWithFrame:CGRectMake(173, 694, 69, 22)];
    [self.logo setImage:[UIImage imageNamed:@"logo"]];
    [self.view addSubview:self.logo];
    
    //  登錄按鈕的相關設置
    self.loginButton=[[UIButton alloc] initWithFrame:CGRectMake(66, 282, 318, 50)];
    [self.loginButton setBackgroundImage:[UIImage imageNamed:@"loginButton"] forState:UIControlStateNormal];
    [self.loginButton setTitle:@"登錄" forState:UIControlStateNormal];
    //  事件監聽
    [self.loginButton addTarget:self action:@selector(hideKeyBoard) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.loginButton];
    
    // 註冊按鈕的相關設置
    self.rigisterButton=[[UIButton alloc] initWithFrame:CGRectMake(66, 338, 318, 50)];
    [self.rigisterButton setBackgroundImage:[UIImage imageNamed:@"rigisterButton"] forState:UIControlStateNormal];
    [self.rigisterButton setTitle:@"註冊" forState:UIControlStateNormal];
    
    //  事件監聽
    [self.rigisterButton addTarget:self action:@selector(hideKeyBoard) forControlEvents:UIControlEventTouchUpInside];
    [self.rigisterButton setTitleColor:[UIColor greenColor] forState:UIControlStateNormal];
    [self.view addSubview:self.rigisterButton];
    
}
// 點擊空白區域  隱藏鍵盤
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    [self hideKeyBoard];
}

-(void)hideKeyBoard
{
    if ([self.Intele isFirstResponder]||[self.Inpassword isFirstResponder]){
        [self.Intele resignFirstResponder];
        [self.Inpassword resignFirstResponder];
    }
    
}

運行結果:

 

 


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 在Archive項目時,出現了“Your build settings specify a provisioning profile with the UUID “”, however, no such provisioning profile was found”的出錯。一直提示指定UUID的pr
  • Fragment 用途:在一個Activity里切換界面,切換界面時只切換Fragment裡面的內容 生命周期方法跟Activity一致,可以理解把其為就是一個Activity 定義佈局文件作為Fragment的顯示內容 //此方法返回的View就會被顯示在Fragment上 @Override p
  • 多媒體概念 文字、圖片、音頻、視頻 電腦圖片大小的計算 圖片大小 = 圖片的總像素 * 每個像素占用的大小 單色圖:每個像素占用1/8個位元組 16色圖:每個像素占用1/2個位元組 256色圖:每個像素占用1個位元組 24點陣圖:每個像素占用3個位元組 載入大圖片到記憶體 Android系統以ARGB表示每個
  • 內容提供者 應用的資料庫是不允許其他應用訪問的 內容提供者的作用就是讓別的應用訪問到你的資料庫 自定義內容提供者,繼承ContentProvider類,重寫增刪改查方法,在方法中寫增刪改查資料庫的代碼,舉例增方法 @Override public Uri insert(Uri uri, Conten
  • 創建第二個Activity 需要在清單文件中為其配置一個activity標簽 標簽中如果帶有這個子節點,則會在系統中多創建一個快捷圖標 <intent-filter> <action android:name="android.intent.action.MAIN" /> <category and
  • 接上篇博文:http://www.cnblogs.com/lance2016/p/5229073.html 上一節課給大家簡單介紹了下android撥號盤的工程概況,今天再向大家剖析一下主界面的佈局實現 先貼上主界面佈局: <?xml version="1.0" encoding="utf-8"?>
  • 什麼是UIScrollView •設備的屏幕大小是極其有限的,因此直接展示在用戶眼前的內容也相當有限 • •當展示的內容較多,超出一個屏幕時,用戶可通過滾動手勢來查看屏幕以外的內容 • •普通的UIView不具備滾動功能,不能顯示過多的內容 • •UIScrollView是一個能夠滾動的視圖控制項,可
  • 前言:本隨筆將對IOS開發的支付功能進行一個概述。 內容大綱: 一、常見的支付方案簡介 二、第三方支付SDK 三、蘋果官方支付方案 四、Web支付方案 正文: 一、常見的支付方案簡介 在微信支付中 微信支付的網址是: https://pay.weixin.qq.com/wiki/doc/api/in
一周排行
    -Advertisement-
    Play Games
  • 示例項目結構 在 Visual Studio 中創建一個 WinForms 應用程式後,項目結構如下所示: MyWinFormsApp/ │ ├───Properties/ │ └───Settings.settings │ ├───bin/ │ ├───Debug/ │ └───Release/ ...
  • [STAThread] 特性用於需要與 COM 組件交互的應用程式,尤其是依賴單線程模型(如 Windows Forms 應用程式)的組件。在 STA 模式下,線程擁有自己的消息迴圈,這對於處理用戶界面和某些 COM 組件是必要的。 [STAThread] static void Main(stri ...
  • 在WinForm中使用全局異常捕獲處理 在WinForm應用程式中,全局異常捕獲是確保程式穩定性的關鍵。通過在Program類的Main方法中設置全局異常處理,可以有效地捕獲並處理未預見的異常,從而避免程式崩潰。 註冊全局異常事件 [STAThread] static void Main() { / ...
  • 前言 給大家推薦一款開源的 Winform 控制項庫,可以幫助我們開發更加美觀、漂亮的 WinForm 界面。 項目介紹 SunnyUI.NET 是一個基於 .NET Framework 4.0+、.NET 6、.NET 7 和 .NET 8 的 WinForm 開源控制項庫,同時也提供了工具類庫、擴展 ...
  • 說明 該文章是屬於OverallAuth2.0系列文章,每周更新一篇該系列文章(從0到1完成系統開發)。 該系統文章,我會儘量說的非常詳細,做到不管新手、老手都能看懂。 說明:OverallAuth2.0 是一個簡單、易懂、功能強大的許可權+可視化流程管理系統。 有興趣的朋友,請關註我吧(*^▽^*) ...
  • 一、下載安裝 1.下載git 必須先下載並安裝git,再TortoiseGit下載安裝 git安裝參考教程:https://blog.csdn.net/mukes/article/details/115693833 2.TortoiseGit下載與安裝 TortoiseGit,Git客戶端,32/6 ...
  • 前言 在項目開發過程中,理解數據結構和演算法如同掌握蓋房子的秘訣。演算法不僅能幫助我們編寫高效、優質的代碼,還能解決項目中遇到的各種難題。 給大家推薦一個支持C#的開源免費、新手友好的數據結構與演算法入門教程:Hello演算法。 項目介紹 《Hello Algo》是一本開源免費、新手友好的數據結構與演算法入門 ...
  • 1.生成單個Proto.bat內容 @rem Copyright 2016, Google Inc. @rem All rights reserved. @rem @rem Redistribution and use in source and binary forms, with or with ...
  • 一:背景 1. 講故事 前段時間有位朋友找到我,說他的窗體程式在客戶這邊出現了卡死,讓我幫忙看下怎麼回事?dump也生成了,既然有dump了那就上 windbg 分析吧。 二:WinDbg 分析 1. 為什麼會卡死 窗體程式的卡死,入口門檻很低,後續往下分析就不一定了,不管怎麼說先用 !clrsta ...
  • 前言 人工智慧時代,人臉識別技術已成為安全驗證、身份識別和用戶交互的關鍵工具。 給大家推薦一款.NET 開源提供了強大的人臉識別 API,工具不僅易於集成,還具備高效處理能力。 本文將介紹一款如何利用這些API,為我們的項目添加智能識別的亮點。 項目介紹 GitHub 上擁有 1.2k 星標的 C# ...