StoryCode

'분류 전체보기'에 해당되는 글 563건

  1. 동적으로 NavigationBar 와 TableView 추가.code
  2. Status Bar 숨기기 (Carrier/ Wifi/ BatteryIcon Bar)
  3. Constraint 동적 추가
  4. FCM 설정법
  5. CommonLib.swift
  6. Grid Library
  7. SVG Icon
  8. SVG 용량 줄이기
  9. SVG 참고
  10. CSS Grid layout

동적으로 NavigationBar 와 TableView 추가.code

iOS/XCode Swift
반응형

//

//  ViewController.swift

//  ToDoApp2

//

//  Created by GANG WOOK KIM on 17/05/2018.

//  Copyright © 2018 GANG WOOK KIM. All rights reserved.

//


import UIKit


extension ViewController:UITableViewDataSource

{

    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

        return self.items.count

    }

    

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

        let cell: UITableViewCell = UITableViewCell(style: UITableViewCellStyle.subtitle, reuseIdentifier:"Cell")

        cell.textLabel?.text = items[indexPath.row]

        return cell

    }


    // 왼쪽 공백 제거

    /*

    func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {

     

        if(self.tableView.respondsToSelector(Selector("setSeparatorInset:"))) {

            self.tableView.separatorInset = UIEdgeInsetsZero

        }

     

        if(self.tableView.respondsToSelector(Selector("setLayoutMargins:"))) {

            self.tableView.layoutMargins = UIEdgeInsetsZero

        }

     

        if(cell.respondsToSelector(Selector("setLayoutMargins:"))) {

            cell.layoutMargins = UIEdgeInsetsZero

        }

    }

    */

    

    func numberOfSectionsInTableView(tableView: UITableView) -> Int {

        return 1

    }

}


extension ViewController:UITableViewDelegate

{

    // 터치시 터치한 아이템을 처리한다.

    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {

        print(items[indexPath.row])

    }

}


class ViewController: UIViewController {

    // ** TableView Variable

    var items:[String] = ["First", "Second", "Third"]

    var tableView: UITableView!


   

    override func viewDidLoad() {

        super.viewDidLoad()

        let navigationBarHeight:Int = 44

        // ** Add Navigation Bar

        let navigationBar = UINavigationBar(frame:CGRect(x:0, y:0, width:Int(view.frame.size.width),height:navigationBarHeight))

        navigationBar.backgroundColor = UIColor.gray

        

        let navigationItem = UINavigationItem()

        navigationItem.title = "AlimPang"

        

        let leftButton = UIBarButtonItem(title:"Save", style: .plain, target: self, action:#selector(ViewController.btn_clicked(_:)))

        let rightButton = UIBarButtonItem(title:"Right", style: .plain, target: self, action:nil)

        

        navigationItem.leftBarButtonItem = leftButton

        navigationItem.rightBarButtonItem = rightButton

        

        navigationBar.items = [navigationItem]

        self.view.addSubview(navigationBar)

        

        // ** TableView Adding

        let barHeight: CGFloat = UIApplication.shared.statusBarFrame.size.height

        let displayWidth: CGFloat = self.view.frame.width

        let displayHeight: CGFloat = self.view.frame.height

        

        tableView = UITableView(frame: CGRect(x: CGFloat(0), y: CGFloat(navigationBarHeight), width: displayWidth, height: displayHeight - barHeight - CGFloat(navigationBarHeight)))

        tableView.register(UITableViewCell.self, forCellReuseIdentifier: "MyCell")

        tableView.dataSource = self

        tableView.delegate = self

        self.view.addSubview(tableView)

        

        /*

        self.tableView.translatesAutoresizingMaskIntoConstraints = false

        self.view.addConstraint(NSLayoutConstraint(item: self.tableView,

                                                   attribute: .top, relatedBy: .equal, toItem: self.view,

                                                   attribute: .top, multiplier: 1.0, constant: 0))

        self.view.addConstraint(NSLayoutConstraint(item: self.tableView,

                                                   attribute: .bottom, relatedBy: .equal, toItem: self.view,

                                                   attribute: .bottom, multiplier: 1.0, constant: 0))

        self.view.addConstraint(NSLayoutConstraint(item: self.tableView,

                                                   attribute: .leading, relatedBy: .equal, toItem: self.view,

                                                   attribute: .leading, multiplier: 1.0, constant: 0))

        */

    }


    override func didReceiveMemoryWarning() {

        super.didReceiveMemoryWarning()

        // Dispose of any resources that can be recreated.

    }


    override func viewWillAppear(_ animated: Bool)

    {

        super.viewWillAppear(animated)

        UIApplication.shared.isStatusBarHidden = true

        //tableView.reloadData()

        /*

        let screenSize:CGRect = UIScreen.main.bounds

        

        tableView.frame = CGRect(x:0, y:0, width:screenSize.width, height:screenSize.height)

        tableView.dataSource = self

        tableView.delegate = self

        tableView.register(UITableViewCell.self, forCellReuseIdentifier:"myCell")

        self.view.addSubview(tableView)

        */

    }

    @objc func btn_clicked(_ sender:UIBarButtonItem)

    {

        

    }

}


반응형

'iOS > XCode Swift' 카테고리의 다른 글

Android 와 SWIFT 개념 비교  (0) 2018.05.20
화면 처리 순서  (0) 2018.05.19
Status Bar 숨기기 (Carrier/ Wifi/ BatteryIcon Bar)  (0) 2018.05.18
Constraint 동적 추가  (0) 2018.05.17
CommonLib.swift  (0) 2018.05.17

Status Bar 숨기기 (Carrier/ Wifi/ BatteryIcon Bar)

iOS/XCode Swift
반응형

1. info.plist 에서 (+) 를 눌러 View controller-based status...를 추가한다.

Value = NO 로 한다.



그리고, (+) 를 눌러 Status bar is initially hidden = YES 도 추가한다.


2. ViewController.swift 열어서 아래 코드를 추가한다.


override func viewWillAppear(_ animated: Bool)

{

    super.viewWillAppear(animated)

    UIApplication.shared.isStatusBarHidden = true

}

반응형

'iOS > XCode Swift' 카테고리의 다른 글

화면 처리 순서  (0) 2018.05.19
동적으로 NavigationBar 와 TableView 추가.code  (0) 2018.05.18
Constraint 동적 추가  (0) 2018.05.17
CommonLib.swift  (0) 2018.05.17
Class 정의  (0) 2018.05.16

Constraint 동적 추가

iOS/XCode Swift
반응형
self.myTableView.translatesAutoresizingMaskIntoConstraints = false

self.view.addConstraint(NSLayoutConstraint(item: self.myTableView, attribute: .top, relatedBy: .equal, toItem: self.view, attribute: .top, multiplier: 1.0, constant: 0))

self.view.addConstraint(NSLayoutConstraint(item: self.myTableView, attribute: .bottom, relatedBy: .equal, toItem: self.view, attribute: .bottom, multiplier: 1.0, constant: 0))

self.view.addConstraint(NSLayoutConstraint(item: self.myTableView, attribute: .leading, relatedBy: .equal, toItem: self.view, attribute: .leading, multiplier: 1.0, constant: 0))


참고 : https://magi82.github.io/implement-uitableview-programmatically-in-swift/

반응형

'iOS > XCode Swift' 카테고리의 다른 글

동적으로 NavigationBar 와 TableView 추가.code  (0) 2018.05.18
Status Bar 숨기기 (Carrier/ Wifi/ BatteryIcon Bar)  (0) 2018.05.18
CommonLib.swift  (0) 2018.05.17
Class 정의  (0) 2018.05.16
애플 Swift Standard Library  (0) 2018.05.16

FCM 설정법

iOS/FCM with XCode Swift
반응형

참고 : http://zeany.net/28

반응형

CommonLib.swift

iOS/XCode Swift
반응형

//

//  CommonLib.swift

//  TodoBox

//

//  Created by GANG WOOK KIM on 16/05/2018.

//  Copyright © 2018 GANG WOOK KIM. All rights reserved.

//


import Foundation

import UIKit


public class CommonLib

{

    init()

    {

        

    }


    class public func UIColorFromRGB(_ rgbValue: UInt) -> UIColor

    {

        return UIColor(

                red:   CGFloat((rgbValue & 0xFF0000) >> 16) / 255.0,

                green: CGFloat((rgbValue & 0x00FF00) >>  8) / 255.0,

                blue:  CGFloat( rgbValue & 0x0000FF       ) / 255.0,

                alpha: CGFloat(1.0)

        )

    }

    

    class public func UIColorFromRGB(_ rgbValue:String) -> UIColor

    {

        var cString:String = rgbValue.trimmingCharacters(in: .whitespacesAndNewlines).uppercased()

        if (cString.hasPrefix("#"))

        {

             cString.remove(at: cString.startIndex)

        }

           

        if ((cString.count) != 6)

        {

             return UIColor.gray

        }


        var rgbValue:UInt32 = 0

        Scanner(string: cString).scanHexInt32(&rgbValue)


        return UIColor(

           red:   CGFloat((rgbValue & 0xFF0000) >> 16) / 255.0,

           green: CGFloat((rgbValue & 0x00FF00) >>  8) / 255.0,

           blue:  CGFloat( rgbValue & 0x0000FF       ) / 255.0,

           alpha: CGFloat(1.0)

        )

    }

}



반응형

'iOS > XCode Swift' 카테고리의 다른 글

Status Bar 숨기기 (Carrier/ Wifi/ BatteryIcon Bar)  (0) 2018.05.18
Constraint 동적 추가  (0) 2018.05.17
Class 정의  (0) 2018.05.16
애플 Swift Standard Library  (0) 2018.05.16
Swift.org  (0) 2018.05.16

Grid Library

Web Dev, HTML, CSS, SVG, BootStrap/CSS Grid Layout
반응형

1) https://blueprintcss.io

2) http://simplegrid.io

3) https://kamalkhan.github.io/awesome-grid/


4) https://www.cssscript.com/tag/grid-layout/

반응형

'Web Dev, HTML, CSS, SVG, BootStrap > CSS Grid Layout' 카테고리의 다른 글

CSS Grid vs Flex  (0) 2018.10.25
CSS Grid Syntax Summary  (0) 2018.10.25
CSS Grid 기본 이해하기  (0) 2018.10.25
CSS Grid layout  (0) 2018.05.16

SVG Icon

Web Dev, HTML, CSS, SVG, BootStrap/Icon, 아이콘
반응형

<svg width="50" height="50" viewBox="0 0 50 50">

<path d="M11,22C4.9,22,0,17.1,0,11C0,4.9,4.9,0,11,0s11,4.9,11,11C22,17.1,17.1,22,11,22zM11,2c-5,0-9,4-9,9c0,5,4,9,9,9s9-4,9-9C20,6,16,2,11,2z M15.2,12.1l-5.5,3.6c-1,0.6-1.8,0.2-1.8-1V7.3c0-1.2,0.8-1.6,1.8-1l5.5,3.6C16.2,10.5,16.2,11.5,15.2,12.1z"></path>

</svg>




<svg width="50" height="50" viewBox="0 0 50 50">


  <path d="M13.4,13.1C13.4,13,13.4,13,13.4,13.1L11.9,13h-1.4v-1.4V9.3V9C10.3,9,10.1,8.9,9.8,8.9c0.6-0.6,1-1.5,1.4-2.7

    c0.3-0.6,0.2-1.2,0.2-2c0-0.6,0.1-1.5,0-2C11,0.5,9.7,0,8.3,0C6.8,0,5.6,0.5,5.1,2.2c-0.1,0.5,0,1.4,0,2c0,0.8,0,1.3,0.2,2

    c0.4,1.1,0.8,2,1.3,2.6c0,0.1,0,0.1-0.1,0.1c-2.1,0.4-3.5,1.5-4.5,2C0,11.8,0,12.8,0,12.8c0,0,0,0,0,0v1.6c0,0.1,0,0.1,0.1,0.1

    l13.3,0v0V13.1z"></path>

  <path d="M19.9,9.3h-2.7c-0.1,0-0.1,0-0.1-0.1V6.5c0-0.1,0-0.1-0.1-0.1h-2.1c-0.1,0-0.1,0-0.1,0.1l0,2.7c0,0.1,0,0.1-0.1,0.1l-2.7,0

    c-0.1,0-0.1,0-0.1,0.1v2.1c0,0.1,0,0.1,0.1,0.1h2.7c0.1,0,0.1,0,0.1,0.1v2.7c0,0.1,0,0.1,0.1,0.1H17c0.1,0,0.1,0,0.1-0.1v-2.7

    c0-0.1,0-0.1,0.1-0.1l2.7,0c0.1,0,0.1,0,0.1-0.1L19.9,9.3C20,9.4,20,9.3,19.9,9.3z"></path>


</svg>






<svg width="50" height="50" viewBox="0 0 50 50">

  <path d="M11,22C4.9,22,0,17.1,0,11S4.9,0,11,0s11,4.9,11,11S17.1,22,11,22z M11,2c-5,0-9,4-9,9s4,9,9,9s9-4,9-9S16,2,11,2z"></path>

  <path d="M15.3,10H12V6.7c0-0.5-0.5-1-1-1s-1,0.5-1,1V10H6.7c-0.5,0-1,0.5-1,1s0.5,1,1,1H10v3.3c0,0.5,0.5,1,1,1s1-0.5,1-1V12h3.3

  c0.5,0,1-0.5,1-1S15.8,10,15.3,10z"></path>

</svg>




<svg width="50" height="50" viewBox="0 0 50 50">

  <path d="M14.5,6.5h-5v-5C9.5,0.7,8.8,0,8,0S6.5,0.7,6.5,1.5v5h-5C0.7,6.5,0,7.2,0,8s0.7,1.5,1.5,1.5h5v5C6.5,15.3,7.2,16,8,16s1.5-0.7,1.5-1.5v-5h5C15.3,9.5,16,8.8,16,8S15.3,6.5,14.5,6.5z"></path>

</svg>






.a{fill-rule:evenodd;}checkmark-18 left-chevron-small .st0{fill-rule:evenodd;clip-rule:evenodd;} right-chevron-small .st0{fill-rule:evenodd;clip-rule:evenodd;} instruction instruction instruction practiceIcon Copy 5 Created with Sketch. .st0{fill:none;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;} .st0{fill:#010101;} .a{fill-rule:evenodd;}info-i certificate seal-mask seal-36 .a{fill-rule:evenodd;}stat-badges .a{fill-rule:evenodd;}stat-challenges .a{fill-rule:evenodd;}stat-courses .a{fill-rule:evenodd;}stat-hours .a{fill-rule:evenodd;}stat-months .a{fill-rule:evenodd;}stat-points .a{fill-rule:evenodd;}stat-project .a{fill-rule:evenodd;}stat-quizzes .a{fill-rule:evenodd;}techdegree .st0{fill:#FFFFFF;} .st0{fill:#6B6E71;} .a{fill-rule:evenodd;}bell-18 .a{fill-rule:evenodd;}briefcase-18 .a{fill-rule:evenodd;}browser-18 .a{fill-rule:evenodd;}calendar-18 .a{fill-rule:evenodd;}megaphone-18 .a{fill-rule:evenodd;}mentor-18 .a{fill-rule:evenodd;}techdegree-18 .a{fill-rule:evenodd;}browser-handle
반응형

'Web Dev, HTML, CSS, SVG, BootStrap > Icon, 아이콘' 카테고리의 다른 글

지구, Earth  (0) 2018.05.27

SVG 용량 줄이기

Web Dev, HTML, CSS, SVG, BootStrap/SVG
반응형

방법 1) SVGO.npm

방법 2) SVGO.gui


아래 git 참조.


https://github.com/svg/svgo

반응형

'Web Dev, HTML, CSS, SVG, BootStrap > SVG' 카테고리의 다른 글

SVG 참고  (0) 2018.05.17

SVG 참고

Web Dev, HTML, CSS, SVG, BootStrap/SVG
반응형

[ 읽어 볼 것 ]

https://svgontheweb.com/ko/#animating



[ SVG Animation Library ]

http://snapsvg.io/demos/


이 라이브러리와 HTML5 Animation 기능을 합치면 구현이 용이할 듯.

반응형

'Web Dev, HTML, CSS, SVG, BootStrap > SVG' 카테고리의 다른 글

SVG 용량 줄이기  (0) 2018.05.17

CSS Grid layout

Web Dev, HTML, CSS, SVG, BootStrap/CSS Grid Layout
반응형



참고 : https://developer.mozilla.org/ko/docs/Web/CSS/CSS_Grid_Layout

2017-499.pptx



추가 자료 : https://developer.mozilla.org/ko/docs/Web/CSS/CSS_Grid_Layout/그리드_템플릿_영역


반응형

'Web Dev, HTML, CSS, SVG, BootStrap > CSS Grid Layout' 카테고리의 다른 글

CSS Grid vs Flex  (0) 2018.10.25
CSS Grid Syntax Summary  (0) 2018.10.25
CSS Grid 기본 이해하기  (0) 2018.10.25
Grid Library  (0) 2018.05.17