This repository was archived by the owner on Jul 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMesureViewController.swift
More file actions
69 lines (53 loc) · 2.08 KB
/
MesureViewController.swift
File metadata and controls
69 lines (53 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//
// MesureViewController.swift
// InteglassApp
//
// Created by YotaOdaka on 2015/04/14.
// Copyright (c) 2015年 YotaOdaka. All rights reserved.
//
import UIKit
import CoreGraphics
class MesureViewController: UIViewController {
@IBOutlet weak var imageView: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
UIGraphicsBeginImageContext(CGSizeMake(300, 300))
//1.グラフィックスコンテキストを取得
let context:CGContextRef = UIGraphicsGetCurrentContext()
//2.描画用の設定(図形の線の太さを設定)
CGContextSetLineWidth(context, 2.0)
//2.描画用の設定(図形の線の色を設定)
let color:CGColorRef = UIColor.redColor().CGColor
CGContextSetStrokeColorWithColor(context, color)
//3.パスを作成
CGContextMoveToPoint(context, 50, 50)
CGContextAddLineToPoint(context, 250, 250)
//4.パスを閉じる
CGContextClosePath(context)
//4.パスで指定した図形を描画
CGContextStrokePath(context)
//5.UIImageの取得
let img:CGImageRef = CGBitmapContextCreateImage(context)
imageView.image = UIImage(CGImage: img)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
//define method to return to here from next view
@IBAction func returnToRecipeMeasure(segue: UIStoryboardSegue){
}
//hide status bar
override func prefersStatusBarHidden()->Bool{
return true
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}