iOS--APP 登入介面圖(xuer)

來源:互聯網
上載者:User

標籤:

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];    }    }

運行結果:

 

 

iOS--APP 登入介面圖(xuer)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.