iOS 프로그래밍: 간단한 웹뷰 앱 만들기
info.plist 편집
이 설정을 하지 않으면 웹사이트가 앱에 나타나지 않습니다.
스토리보드 작성 및 ViewController.swift 편집
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//
// ViewController.swift
// WebMusic
//
// Created by yoonbumtae on 2020/02/14.
// Copyright © 2020 BGSMM. All rights reserved.
//
import UIKit
import WebKit
class ViewController: UIViewController {
@IBOutlet weak var wvMain: WKWebView!
func goWeb(postfix: String) -> () {
let url = URL(string: "http://yoonbumtae.com/music/\(postfix)")
let request = URLRequest(url: url!)
wvMain.load(request)
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
goWeb(postfix: "scale")
}
@IBAction func btnScale(_ sender: UIButton) {
goWeb(postfix: "scale")
}
@IBAction func btnFreq(_ sender: UIButton) {
goWeb(postfix: "freq")
}
}
결과 확인
웹뷰앱만들기 아이오에스 iOS 웹뷰 만들기 WebView
This post is licensed under
CC BY 4.0
by the author.



