IFTTT / FastttCamera

Fasttt and easy camera framework for iOS with customizable filters
http://ifttt.github.io
MIT License
1.86k stars 189 forks source link

Square preview image #28

Closed SamDavies closed 9 years ago

SamDavies commented 9 years ago

How do I automatically crop the camera to a square UIView as it says in the README?

Preferably in swift.

lauraskelton commented 9 years ago

FastttCamera will crop the photos you take to whatever the size of its view is. To make a camera that takes square photos, just make your FastttCamera's view square when you lay it out in the parent view controller.

If you check out the Example project, you can see how we've set it up using Masonry auto layout. You can use SnapKit to do something similar in Swift.

[self.fastCamera.view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self.view);
        make.height.and.width.lessThanOrEqualTo(self.view.mas_width).with.priorityHigh();
        make.height.and.width.lessThanOrEqualTo(self.view.mas_height).with.priorityHigh();
        make.height.and.width.equalTo(self.view.mas_width).with.priorityLow();
        make.height.and.width.equalTo(self.view.mas_height).with.priorityLow();
    }];