Skip to content

Instantly share code, notes, and snippets.

@chuck0523
Created June 28, 2016 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chuck0523/12abc95397c971df1275912448a4580b to your computer and use it in GitHub Desktop.
Save chuck0523/12abc95397c971df1275912448a4580b to your computer and use it in GitHub Desktop.
//
// ViewController.swift
// 007
//
// Created by chuck on 6/29/16.
// Copyright © 2016 chuck. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let mySmallLabel: UILabel = UILabel()
mySmallLabel.font = UIFont.systemFontOfSize(UIFont.smallSystemFontSize())
mySmallLabel.text = "小さめのフォントサイズ"
mySmallLabel.frame = CGRect(x: 25, y:0, width: 300, height: 150)
self.view.addSubview(mySmallLabel)
let myNormalLabel: UILabel = UILabel()
myNormalLabel.font = UIFont.systemFontOfSize(UIFont.systemFontSize())
myNormalLabel.text = "システム標準のフォントサイズ"
myNormalLabel.frame = CGRect(x: 25, y:30, width:200, height: 150)
self.view.addSubview(myNormalLabel)
let myButtonLabel: UILabel = UILabel()
myButtonLabel.font = UIFont.systemFontOfSize(UIFont.buttonFontSize())
myButtonLabel.text = "UIButtonのフォントサイズ"
myButtonLabel.frame = CGRect(x: 25, y: 60, width: 300, height: 150)
self.view.addSubview(myButtonLabel)
let myCustomLabel: UILabel = UILabel()
myCustomLabel.font = UIFont.systemFontOfSize(CGFloat(20))
myCustomLabel.text = "ポイント20のフォントサイズ"
myCustomLabel.frame = CGRect(x: 25, y: 90, width: 300, height: 150)
self.view.addSubview(myCustomLabel)
let myItalicLabel: UILabel = UILabel()
myItalicLabel.font = UIFont.italicSystemFontOfSize(UIFont.labelFontSize())
myItalicLabel.text = "Italicフォント"
myItalicLabel.frame = CGRect(x: 25, y: 150, width: 300, height: 150)
self.view.addSubview(myItalicLabel)
let myBoldLabel: UILabel = UILabel()
myBoldLabel.font = UIFont.boldSystemFontOfSize(UIFont.labelFontSize())
myBoldLabel.text = "Boldフォント"
myBoldLabel.frame = CGRect(x: 25, y: 180, width: 300, height: 150)
self.view.addSubview(myBoldLabel)
let myAlialLabel: UILabel = UILabel()
myAlialLabel.font = UIFont(name: "ArialHebew", size:UIFont.labelFontSize())
myAlialLabel.text = "ArialHebrew"
myAlialLabel.frame = CGRect(x: 25, y: 230, width: 300, height: 150)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment