• iOS 本地加载html登陆页面


    Html的代码

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>登陆页面</title>
        <link href="CSS/Login.css" rel="stylesheet">
    </head>
    <body>
    <!--最外层-->
        <div id="content">
            <!--面板-->
            <div class="panel">
                <!--账号-->
                <div class="group">
                    <label>账号</label>
                    <input placeholder="请输入账号">
                </div>
                <!--密码-->
                <div class="group">
                    <label>密码</label>
                    <input placeholder="请输入密码" type="password">
                </div>
                <!--登陆-->
                <div class="login">
                    <button>登陆</button>
                </div>
            </div>
            <!--注册-->
            <div class="reg">
                <button>创建新账号?</button>
            </div>
        </div>
    </body>
    </html>
    

    CSS的代码

    body{
        background-color: #f2f2f2;
    }
    
    #content{
        margin-top: 100px;
        /*background: red;*/
        text-align: center;
    }
    
    #content .panel{
        display: inline-block;
        background-color: white;
        border: 1px solid #ddd;
        border-radius:  5px;
        padding: 20px;
    }
    
    #content .panel .group{
    
    }
    /*s输入框*/
    #content .panel .group input{
        display: block;
        width: 250px;
        height: 33px;
        padding-left: 7px;
        font-size: 15px;
        border: 2px solid #ddd;
    }
    
    /*伪类*/
    #content .panel .group input:focus {
        outline: none;
        border-color: #CC865E;
    }
    #content .panel .group label{
        display: block;
        text-align: left;
        height: 30px;
        line-height:  30px;
        font-size: 20px;
    }
    
    #content .login{
        margin-top: 20px;
    }
    /*登陆*/
    #content .login button{
        width: 250px;
        background-color: #CC865E;
    }
    
    #content .login button:hover{
        background-color: white;
        color: #CC865E;
        border: 1px solid #CC865E;
        cursor: pointer;
    }
    
    #content button{
        height:  33px;
        border: 0px;
        color: white;
        font-size:  18px;
        border-radius: 3px;
    }
    
    #content .reg{
        margin-top: 20px;
    }
    
    /*注册*/
    #content .reg button{
        width: 250px;
        background-color: #466BAF;
    }
    
    #content .reg button:hover {
        background-color:white;
        color: #466BAF;
        border: 1px solid #466BAF;
        cursor: pointer;
    }

    iOS 的代码

    #import <UIKit/UIKit.h>
    
    @interface AppDelegate : UIResponder <UIApplicationDelegate>
    
    @property (strong, nonatomic) UIWindow *window;
    
    
    @end
    #import "AppDelegate.h"
    #import "RootViewController.h"
    @interface AppDelegate ()
    
    @end
    
    @implementation AppDelegate
    
    
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
        // Override point for customization after application launch.
        self.window.backgroundColor = [UIColor whiteColor];
        
        self.window.rootViewController = [[RootViewController alloc] init];
        
        [self.window makeKeyAndVisible];
        return YES;
    }
    
    
    @end
    #import <UIKit/UIKit.h>
    
    @interface RootViewController : UIViewController
    
    @end
    #import "RootViewController.h"
    
    @interface RootViewController ()
    
    @property (nonatomic , strong) UIWebView *webView;
    
    @end
    
    @implementation RootViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
        
        //html在本地的路径(/Users/apple/WebstormProjects/LoginPage/Login.html)
        NSURL *url = [NSURL fileURLWithPath:@"/Users/apple/WebstormProjects/LoginPage/Login.html"];
        NSURLRequest *request = [NSURLRequest requestWithURL:url];
        UIWebView *aWebView = [[UIWebView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
        self.webView = aWebView;
        [self.webView loadRequest:request];
        [self.view addSubview:self.webView];
    
    }
    @end
  • 相关阅读:
    数据结构-栈(二)模板-C++实现-2,8,16进制转换
    数据结构-栈(一)模板-C++实现
    数据结构-环形队列-队列模板实现-c++代码
    【Prince2科普】Prince2七大流程概论
    自定义时代项目经理的自我修炼 受控环境下项目管理的实践应用
    【项目管理】《挑战埃及》沙盘介绍
    【Prince2科普】P2七大主题之进展
    【Prince2科普】P2七大主题之变更
    【Prince2科普】P2七大主题之风险
    【Prince2科普】P2七大主题之计划
  • 原文地址:https://www.cnblogs.com/lantu1989/p/5875084.html
Copyright © 2020-2023  润新知