代码之家  ›  专栏  ›  技术社区  ›  Invictus Cody

Objective-C框架BJImageCropper边框角

  •  0
  • Invictus Cody  · 技术社区  · 10 年前

    我想更改的边界角的设计 BJImageCropper 这样地 Sample Image 有人能帮我吗?

    目前我正在使用此代码初始化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];
    

    如果有任何其他图像裁剪框架具有与示例图像类似的边框角,这可能也会有所帮助。

    1 回复  |  直到 8 年前
        1
  •  0
  •   Invictus Cody    10 年前

    我用过 BFCropInterface ,实际上是的修改版本 BJ图像切割器 。您将获得的所有委托方法 BJ图像切割器 在里面 BFCrop接口 .
    替换以下部分 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];
    

    使用此:

    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"]]; 
    

    哪里 .png格式 s有点像 This

    并在我的代码中使用以下代码实现了框架:

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

    增加的值 nodeRadius 以增大角图像的大小。