forked from coding/Coding-iOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMJPhoto.m
More file actions
executable file
·31 lines (26 loc) · 721 Bytes
/
MJPhoto.m
File metadata and controls
executable file
·31 lines (26 loc) · 721 Bytes
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
//
// MJPhoto.m
//
// Created by mj on 13-3-4.
// Copyright (c) 2013年 itcast. All rights reserved.
#import <QuartzCore/QuartzCore.h>
#import "MJPhoto.h"
@implementation MJPhoto
#pragma mark 截图
- (UIImage *)capture:(UIView *)view
{
UIGraphicsBeginImageContextWithOptions(view.bounds.size, YES, 0.0);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;
}
- (void)setSrcImageView:(UIImageView *)srcImageView
{
_srcImageView = srcImageView;
_placeholder = srcImageView.image;
if (srcImageView.clipsToBounds) {
_capture = [self capture:srcImageView];
}
}
@end