質問編集履歴

6

修正

2016/12/13 10:36

投稿

deltaZone
deltaZone

スコア12

test CHANGED
File without changes
test CHANGED
@@ -110,9 +110,9 @@
110
110
 
111
111
  picture説明
112
112
 
113
- 黄色 imageのサイズ、
113
+ 黄色 imageView.imageのサイズ、
114
114
 
115
- 青 scrollViewのframe
115
+ 青 scrollViewのframe(見えている部分)
116
116
 
117
117
  緑 CGRectMake(scrollView.contentOffset.x/ scale,scrollView.contentOffset.y/ scale,scrollView.frame.size.width/ scale,scrollView.frame.size.height/ scale)で取れているように見える矩形
118
118
 

5

イメージの追加

2016/12/13 10:36

投稿

deltaZone
deltaZone

スコア12

test CHANGED
File without changes
test CHANGED
@@ -103,3 +103,23 @@
103
103
  取得したい拡大時のrect.sizeであることがわかりましたが
104
104
 
105
105
  imageの内、見えている部分の座標が未だに正確に取得できないです
106
+
107
+
108
+
109
+
110
+
111
+ picture説明
112
+
113
+ 黄色 imageのサイズ、
114
+
115
+ 青 scrollViewのframe
116
+
117
+ 緑 CGRectMake(scrollView.contentOffset.x/ scale,scrollView.contentOffset.y/ scale,scrollView.frame.size.width/ scale,scrollView.frame.size.height/ scale)で取れているように見える矩形
118
+
119
+
120
+
121
+ 今知りたいのは黄色のimageの中での青の矩形の座標です。
122
+
123
+
124
+
125
+ ![イメージ説明](7d35f2d7f05cceca684d15ba2db7c6ed.png)

4

修正

2016/12/13 10:34

投稿

deltaZone
deltaZone

スコア12

test CHANGED
File without changes
test CHANGED
@@ -102,4 +102,4 @@
102
102
 
103
103
  取得したい拡大時のrect.sizeであることがわかりましたが
104
104
 
105
- 座標が未だに正確に取得できないです
105
+ imageの内、見えている部分の座標が未だに正確に取得できないです

3

説明追加

2016/12/12 15:22

投稿

deltaZone
deltaZone

スコア12

test CHANGED
File without changes
test CHANGED
@@ -64,4 +64,42 @@
64
64
 
65
65
  ```
66
66
 
67
- では上手くとれなかったです
67
+ では上手くとれなかったです
68
+
69
+
70
+
71
+ 追記:
72
+
73
+ ログを出してみると
74
+
75
+ ▷▷▷拡大前
76
+
77
+ ▷scrollView frame = (0 0; 328 328) contentOffset: {0, 0}; contentSize: {0, 0}
78
+
79
+ ▷scrollView Bounds = (0.0, 0.0, 328.0, 328.0)
80
+
81
+ ▷ImageView frame = (0 0; 383 383)
82
+
83
+ ▷ImageView's image = {2448, 2448}
84
+
85
+
86
+
87
+ ▷▷▷拡大後
88
+
89
+ ▷scrollView frame = (0 0; 328 328) contentOffset: {107.5, 128.5}; contentSize: {597.26526, 597.26526}
90
+
91
+ ▷scrollView Bounds is (107.5, 128.5, 328.0, 328.0)
92
+
93
+ ▷ImageView is frame = (0 0; 597.265 597.265)
94
+
95
+ ▷ImageView's image = {2448, 2448}
96
+
97
+ のようになっていて拡大時にはscrollViewのcontentOffsetとcontentSizeの変化に合わせてそのboundsとその下階層にあるImageViewのframeが変わっています。
98
+
99
+
100
+
101
+ その後imageのサイズに1/scaleを乗算したものが
102
+
103
+ 取得したい拡大時のrect.sizeであることがわかりましたが
104
+
105
+ 座標が未だに正確に取得できないんです。

2

説明文追記

2016/12/12 15:19

投稿

deltaZone
deltaZone

スコア12

test CHANGED
File without changes
test CHANGED
@@ -1,10 +1,8 @@
1
1
  現在写真イメージを
2
2
 
3
- ▷UIScrollView
3
+ ▷UIScrollView▷UIImageViewという階層の
4
4
 
5
- ▷UIImageView
6
-
7
- UIImageView.imageに乗せ
5
+ UIImageView.imageに乗せ
8
6
 
9
7
 
10
8
 
@@ -18,7 +16,11 @@
18
16
 
19
17
 
20
18
 
21
- その拡大したイメージを
19
+ して今その拡大したイメージをクロップしたいと思っていますが
20
+
21
+ その拡大時のrectの取り方がわかりません。
22
+
23
+
22
24
 
23
25
  ```swift
24
26
 
@@ -40,11 +42,9 @@
40
42
 
41
43
  のように
42
44
 
43
- クロップしたいのですが
45
+ クロップしたいのですが。。。
44
46
 
45
- cropRectの適切な値が分からずに困っています。
46
47
 
47
- cropRectとはUIImageViewのvisibleな部分のことです。
48
48
 
49
49
 
50
50
 

1

タグ追加

2016/12/12 00:21

投稿

deltaZone
deltaZone

スコア12

test CHANGED
File without changes
test CHANGED
File without changes