Commit 05adb648 authored by huanglu's avatar huanglu

update

parent dca197a9
......@@ -141,6 +141,17 @@ LFPhotoEditOperationStringKey const LFPhotoEditCropCanAspectRatioAttributeName =
[self.view addSubview:_check];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
self.navigationController.navigationBar.hidden = YES;
}
- (void)viewWillLayoutSubviews
{
[super viewWillLayoutSubviews];
......@@ -246,13 +257,43 @@ LFPhotoEditOperationStringKey const LFPhotoEditCropCanAspectRatioAttributeName =
- (void)configCustomNaviBar
{
UIBarButtonItem *sure = [[UIBarButtonItem alloc] initWithTitle:[NSBundle LFME_localizedStringForKey:@"_LFME_oKButtonTitle"] style:UIBarButtonItemStylePlain target:self action:@selector(finishButtonClick)];
UIBarButtonItem *cancel = [[UIBarButtonItem alloc] initWithTitle:[NSBundle LFME_localizedStringForKey:@"_LFME_cancelButtonTitle"] style:UIBarButtonItemStylePlain target:self action:@selector(cancelButtonClick)];
[sure setTintColor:[UIColor whiteColor]];
[cancel setTintColor:[UIColor lightGrayColor]];
self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:(34/255.0) green:(34/255.0) blue:(34/255.0) alpha:0.7];
self.navigationItem.rightBarButtonItem = sure;
self.navigationItem.leftBarButtonItem = cancel;
CGFloat margin = 8, topbarHeight = 0;
if (@available(iOS 11.0, *)) {
topbarHeight = kCustomTopbarHeight_iOS11;
} else {
topbarHeight = kCustomTopbarHeight;
}
CGFloat naviHeight = CGRectGetHeight(self.navigationController.navigationBar.frame);
_edit_naviBar = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, topbarHeight)];
_edit_naviBar.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin;
_edit_naviBar.backgroundColor = [UIColor colorWithRed:(34/255.0) green:(34/255.0) blue:(34/255.0) alpha:0.7];
UIView *naviBar = [[UIView alloc] initWithFrame:CGRectMake(0, topbarHeight-naviHeight, _edit_naviBar.frame.size.width, naviHeight)];
naviBar.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin;
[_edit_naviBar addSubview:naviBar];
UIFont *font = [UIFont systemFontOfSize:15];
CGFloat editCancelWidth = [[NSBundle LFME_localizedStringForKey:@"_LFME_cancelButtonTitle"] boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:font} context:nil].size.width + 30;
UIButton *_edit_cancelButton = [[UIButton alloc] initWithFrame:CGRectMake(margin, 0, editCancelWidth, naviHeight)];
_edit_cancelButton.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
[_edit_cancelButton setTitle:[NSBundle LFME_localizedStringForKey:@"_LFME_cancelButtonTitle"] forState:UIControlStateNormal];
_edit_cancelButton.titleLabel.font = font;
[_edit_cancelButton setTitleColor:self.cancelButtonTitleColorNormal forState:UIControlStateNormal];
[_edit_cancelButton addTarget:self action:@selector(cancelButtonClick) forControlEvents:UIControlEventTouchUpInside];
[naviBar addSubview:_edit_cancelButton];
CGFloat editOkWidth = [[NSBundle LFME_localizedStringForKey:@"_LFME_oKButtonTitle"] boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:font} context:nil].size.width + 30;
UIButton *_edit_finishButton = [[UIButton alloc] initWithFrame:CGRectMake(self.view.width - editOkWidth-margin, 0, editOkWidth, naviHeight)];
_edit_finishButton.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
[_edit_finishButton setTitle:[NSBundle LFME_localizedStringForKey:@"_LFME_oKButtonTitle"] forState:UIControlStateNormal];
_edit_finishButton.titleLabel.font = font;
[_edit_finishButton setTitleColor:self.oKButtonTitleColorNormal forState:UIControlStateNormal];
[_edit_finishButton addTarget:self action:@selector(finishButtonClick) forControlEvents:UIControlEventTouchUpInside];
[naviBar addSubview:_edit_finishButton];
[self.view addSubview:_edit_naviBar];
}
- (void)configBottomToolBar
......@@ -400,8 +441,17 @@ LFPhotoEditOperationStringKey const LFPhotoEditCropCanAspectRatioAttributeName =
}
dispatch_async(dispatch_get_main_queue(), ^{
if ([weakSelf.delegate respondsToSelector:@selector(lf_PhotoEditingController:didFinishPhotoEdit:)]) {
[weakSelf.delegate lf_PhotoEditingController:self didFinishPhotoEdit:photoEdit];
NSData *data = [Utils imageData:photoEdit.editPreviewImage];
NSLog(@"编辑图片-------编辑后的大小:%.2f", (double)data.length / 1024 / 1024);
if(photoEdit) {
NSString *path = [NSString stringWithFormat:@"file://%@",[Utils saveImageTosandBox:data]];
[self.data[@"images"][self.index] setObject:path forKey:@"editedImage"];
}
self.finishBlock(photoEdit, self.data);
}
[weakSelf hideProgressHUD];
});
......
......@@ -109,7 +109,7 @@ NSString *const kLFDrawViewData = @"LFDrawViewData";
UITouch *touch = [touches anyObject];
CGPoint point = [touch locationInView:self];
//设置线宽
path.lineWidth = 4.0f;
path.lineWidth = self.lineWidth;
path.lineCapStyle = kCGLineCapRound; //线条拐角
path.lineJoinStyle = kCGLineJoinRound; //终点处理
[path moveToPoint:point];
......@@ -186,37 +186,37 @@ NSString *const kLFDrawViewData = @"LFDrawViewData";
[self setNeedsDisplay];
}
-(void)drawRect:(CGRect)rect{
if (self.lineArray.count) {
for (LFDrawBezierPath *path in self.lineArray) {
if (path.isErase) {
[self.backgroundColor setStroke];
}else{
[path.color setStroke];
}
path.lineCapStyle = kCGLineCapRound;
path.lineJoinStyle = kCGLineCapRound;
if (path.isErase) {
path.lineWidth = 10; // 这里可抽取出来枚举定义
[path strokeWithBlendMode:kCGBlendModeDestinationIn alpha:1.0];
}else{
path.lineWidth = 4.0f;
[path strokeWithBlendMode:kCGBlendModeNormal alpha:1.0];
}
[path stroke];
}
}
[super drawRect:rect];
}
//-(void)drawRect:(CGRect)rect{
//
// if (self.lineArray.count) {
// for (LFDrawBezierPath *path in self.lineArray) {
// if (path.isErase) {
//
// [self.backgroundColor setStroke];
//
// }else{
// [path.color setStroke];
// }
//
//
// path.lineCapStyle = kCGLineCapRound;
// path.lineJoinStyle = kCGLineCapRound;
// if (path.isErase) {
// path.lineWidth = 10; // 这里可抽取出来枚举定义
// [path strokeWithBlendMode:kCGBlendModeDestinationIn alpha:1.0];
// }else{
// path.lineWidth = 3;
// [path strokeWithBlendMode:kCGBlendModeNormal alpha:1.0];
// }
// [path stroke];
//
// }
//
// }
//
//
// [super drawRect:rect];
//}
//- (void)drawRect:(CGRect)rect{
// //遍历数组,绘制曲线
......
......@@ -18,7 +18,7 @@ NSString *const LFMediaEditingStrings = @"LFMediaEditingController";
static NSBundle *lfMediaEditingBundle = nil;
if (lfMediaEditingBundle == nil) {
// 这里不使用mainBundle是为了适配pod 1.x和0.x
lfMediaEditingBundle = [NSBundle bundleWithPath:[[NSBundle bundleForClass:[LFBaseEditingController class]] pathForResource:@"LFMediaEditingController.bundle/LFMediaEditingController" ofType:@"bundle"]];
lfMediaEditingBundle = [NSBundle bundleWithPath:[[NSBundle bundleForClass:[LFBaseEditingController class]] pathForResource:@"LFMediaEditingController" ofType:@"bundle"]];
}
return lfMediaEditingBundle;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment