Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
//
// 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