1

I am using the wonderful GPUImage library to create a custom camera inside my app. In order to set the layout how I would like it I need to the preview portion of the view to be displayed towards the top of the view. Currently, the GPUImageView only will display at the center no matter how I adjust the crop of the GPUImageView frame.

I have read a few things on github (see below) about placing the GPUImageView inside another UIView in various ways but whenever I attempt some variation of [myUIView addSubview:GPUImageView] I get a variety of errors.

https://github.com/BradLarson/GPUImage/issues/600 -
https://github.com/BradLarson/GPUImage/issues/804 -

I am fairly new to all this so any code help would be greatly appreciated. This is my code without the added UIView I was attempting to place the GPUImageView into.

- (void)loadView 
  {
    CGRect mainScreenFrame = [[UIScreen mainScreen] bounds];
     GPUImageView *primaryView = [[GPUImageView alloc] initWithFrame:mainScreenFrame];
     self.view = primaryView;
   }


- (void)viewDidLoad
  {    
    [super viewDidLoad];

    //Creating a square crop filter
    GPUImageView *filterView = (GPUImageView *)self.view;
    secondFilter = [[GPUImageCropFilter alloc] initWithCropRegion:CGRectMake(0.f, 0.125f, 1.f, .75f)];
    [stillCamera addTarget:secondFilter];
    [secondFilter addTarget:filterView];
   }
4

0 回答 0