//
//  ViewController.swift
//  ex_insertSubView
//
//  Created by yoshiyuki oshige on 2015/09/05.
//  Copyright © 2015年 yoshiyuki oshige. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

    // 木をOutlet接続しておく
    @IBOutlet weak var tree1: UIImageView!
    @IBOutlet weak var tree2: UIImageView!
    @IBOutlet weak var tree3: UIImageView!
    
    @IBAction func insertHouse(sender: AnyObject) {
        // 家のイメージビューhouseを作成する
        let houseImage = UIImage(named: "house.png")
        let house = UIImageView(image: houseImage)
        house.center = CGPoint(x: 150, y: 250)
        
        // houseをtree2の手前の重なりに挿入する
        view.insertSubview(house, aboveSubview: tree2)
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


}

