简体   繁体   English

Objective-C框架BJImageCropper边框角

[英]Objective-C framework BJImageCropper Border corner

I want to change the design for border corner of BJImageCropper like this Sample Image , can anyone help me on this ? 想像这样的示例图像那样更改BJImageCropper边框角的设计,有人可以帮我吗?

Currently I am using this code for initialize BJImageCropper : 目前,我正在使用此代码初始化BJImageCropper:

self.imageCropper = [[BJImageCropper alloc] initWithImage:self.image andMaxSize:CGSizeMake(750,350)];

        self.imageCropper.center = self.cropView.center;
        self.imageCropper.imageView.layer.shadowColor = [[UIColor blackColor] CGColor];
        self.imageCropper.imageView.layer.shadowRadius = 3.0f;
        self.imageCropper.imageView.layer.shadowOpacity = 0.8f;
        self.imageCropper.imageView.layer.shadowOffset = CGSizeMake(1, 1);

        [self.imageCropper addObserver:self forKeyPath:@"crop" options:NSKeyValueObservingOptionNew context:nil];

If there is any other framwork for image cropping that has the border corner like the sample image ,that might help also. 如果还有其他带有边框角(例如样本图像)的图像裁剪框架,这也可能会有所帮助。

I have used BFCropInterface , which is actually modified version of BJImageCropper . 我使用了BFCropInterface ,它实际上是BJImageCropper的修改版本。 You will get all delegate methods of BJImageCropper in BFCropInterface . 您将在BFCropInterface中获得BJImageCropper的所有委托方法。
Replaced below portion in BFCropInterface.m 替换为BFCropInterface.m中的以下部分

 UIImage *nodeImage = [UIImage imageNamed:@"node.png"];
    tlnode = [[UIImageView alloc]initWithImage:nodeImage];
    trnode = [[UIImageView alloc]initWithImage:nodeImage];
    blnode = [[UIImageView alloc]initWithImage:nodeImage];
    brnode = [[UIImageView alloc]initWithImage:nodeImage];

With This : 有了这个 :

tlnode = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"top-left.png"]];
    trnode = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"top-right.png"]];
    blnode = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"bottom-left.png"]];
    brnode = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"bottom-right.png"]]; 

where .png s are something like 其中.png类似于 这个

And have implemented the framework in my code using : 并使用以下代码在我的代码中实现了该框架:

[[BFCropInterface alloc]initWithFrame:self.cropView.bounds andImage:original nodeRadius:50];

increase the value of nodeRadius to increase the size of corner image . 增加nodeRadius的值以增加角图像的大小。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM