Skip to content

Instantly share code, notes, and snippets.

@chuck0523
Created June 24, 2016 11:48
Show Gist options
  • Save chuck0523/627705e6f52d4c6538839d4763378562 to your computer and use it in GitHub Desktop.
Save chuck0523/627705e6f52d4c6538839d4763378562 to your computer and use it in GitHub Desktop.
//
// ViewController.swift
// 004
//
// Created by chuck on 6/24/16.
// Copyright © 2016 chuck. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
private var myImageView: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
// UIImageViewを作成
myImageView = UIImageView(frame: CGRectMake(0,0,100,120))
// 表示する画像を設定
let myImage = UIImage(named: "logo.png") // 画像は同階層に用意しておく必要があります。
myImageView.image = myImage
// 座標を設定
myImageView.layer.position = CGPoint(x: self.view.bounds.width/2, y:200.0)
self.view.addSubview(myImageView)
}
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