@@ -17,6 +17,7 @@ @implementation SSUIViewMiniMe
17
17
UIView *miniMe;
18
18
UIImageView *miniMeImageView;
19
19
UIView *miniMeIndicator;
20
+ NSInteger viewRatio;
20
21
}
21
22
22
23
-(SSUIViewMiniMe *)initWithView : (UIView *)viewToMap withRatio : (NSInteger )ratio
@@ -26,9 +27,9 @@ -(SSUIViewMiniMe *)initWithView:(UIView *)viewToMap withRatio:(NSInteger)ratio
26
27
if (self)
27
28
{
28
29
zoomedView = viewToMap;
29
- _ratio = ratio;
30
+ viewRatio = ratio;
30
31
[self setBackgroundColor: [UIColor blackColor ]];
31
- self.scrollView = [[UIScrollView alloc ]initWithFrame:CGRectMake (0 , 0 , 320 , HEIGHT)];
32
+ self.scrollView = [[UIScrollView alloc ]initWithFrame:CGRectMake (0 , 0 , WIDTH , HEIGHT)];
32
33
self.scrollView .contentSize = CGSizeMake (viewToMap.bounds .size .width , viewToMap.bounds .size .height );
33
34
self.scrollView .delegate = self;
34
35
self.scrollView .minimumZoomScale = 1 ;
@@ -48,7 +49,7 @@ -(SSUIViewMiniMe *)initWithView:(UIView *)viewToMap withRatio:(NSInteger)ratio
48
49
49
50
[self addSubview: self .scrollView];
50
51
51
- miniMe = [[UIView alloc ]initWithFrame:CGRectMake (10 , 10 , viewToMap.frame.size.width/_ratio , viewToMap.frame.size.height/_ratio )];
52
+ miniMe = [[UIView alloc ]initWithFrame:CGRectMake (10 , 10 , viewToMap.frame.size.width/viewRatio , viewToMap.frame.size.height/viewRatio )];
52
53
miniMe.clipsToBounds = YES ;
53
54
miniMeImageView = [[UIImageView alloc ]initWithImage:[self captureScreen: viewToMap]];
54
55
miniMeImageView.frame = CGRectMake (0 , 0 , miniMe.frame .size .width , miniMe.frame .size .height );
@@ -58,8 +59,8 @@ -(SSUIViewMiniMe *)initWithView:(UIView *)viewToMap withRatio:(NSInteger)ratio
58
59
[self addSubview: miniMe];
59
60
60
61
miniMeIndicator = [[UIView alloc ]initWithFrame:CGRectMake (
61
- self .scrollView.contentOffset.x/_ratio /self .scrollView.zoomScale,
62
- self .scrollView.contentOffset.y/_ratio /self .scrollView.zoomScale,
62
+ self .scrollView.contentOffset.x/viewRatio /self .scrollView.zoomScale,
63
+ self .scrollView.contentOffset.y/viewRatio /self .scrollView.zoomScale,
63
64
miniMe.frame.size.width/self .scrollView.zoomScale,
64
65
miniMe.frame.size.height/self .scrollView.zoomScale)];
65
66
@@ -105,7 +106,7 @@ - (void)dragBegan:(UIControl *)c withEvent:ev
105
106
106
107
miniMeIndicator.frame = CGRectMake (touchPoint.x , touchPoint.y , miniMe.frame .size .width /self.scrollView .zoomScale , miniMe.frame .size .height /self.scrollView .zoomScale );
107
108
108
- [self .scrollView setContentOffset: CGPointMake (touchPoint.x*_ratio *self .scrollView.zoomScale, touchPoint.y*_ratio *self .scrollView.zoomScale) animated: NO ];
109
+ [self .scrollView setContentOffset: CGPointMake (touchPoint.x*viewRatio *self .scrollView.zoomScale, touchPoint.y*viewRatio *self .scrollView.zoomScale) animated: NO ];
109
110
}
110
111
111
112
- (void )tapAction : (UITapGestureRecognizer *)sender
@@ -156,8 +157,8 @@ - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
156
157
- (void )scrollViewDidScroll : (UIScrollView *)scrollView
157
158
{
158
159
miniMeIndicator.frame =
159
- CGRectMake (self.scrollView .contentOffset .x /_ratio /self.scrollView .zoomScale ,
160
- self.scrollView .contentOffset .y /_ratio /self.scrollView .zoomScale ,
160
+ CGRectMake (self.scrollView .contentOffset .x /viewRatio /self.scrollView .zoomScale ,
161
+ self.scrollView .contentOffset .y /viewRatio /self.scrollView .zoomScale ,
161
162
miniMeIndicator.frame .size .width ,
162
163
miniMeIndicator.frame .size .height );
163
164
0 commit comments