Skip to content

Instantly share code, notes, and snippets.

@jamztang
Last active October 31, 2021 00:49
Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jamztang/7183939 to your computer and use it in GitHub Desktop.
Save jamztang/7183939 to your computer and use it in GitHub Desktop.
My first hackathon experience - 12 hours of hacking and building the essentials. https://medium.com/p/3db44088db70
- (void)viewDidLoad {
[super viewDidLoad];
self.videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition:AVCaptureDevicePositionFront];
self.videoCamera.outputImageOrientation = UIInterfaceOrientationPortrait;
// self.avatarView is a non full screen GPUImageView instance
// created in Storyboard
[self.videoCamera addTarget:self.avatarView];
[self.videoCamera startCameraCapture];
}
self.blurFilter = ({
GPUImageGaussianBlurFilter *blurFilter = [[GPUImageGaussianBlurFilter alloc] init];
blurFilter.blurSize = 8;
blurFilter;
});
self.videoCamera addTarget:self.blurFilter];
// self.blurView is a fullscreen GPUImageView instance configured in Storyboard
[self.blurFilter addTarget:self.blurView];
self.avatarView.layer.cornerRadius = self.avatarView.frame.size.width/2;
- (void)viewDidLoad {
[super viewDidLoad];
__weak typeof (self) weakSelf = self;
[self.view addKeyboardPanningWithActionHandler:^(CGRect
keyboardFrameInView) {
// Becareful of the retain cycle and use weakSelf instead of self
// when you need to add custom logic in code.
CGRect tableViewFrame = weakSelf.messageView.frame;
tableViewFrame.size.height = toolBarFrame.origin.y;
weakSelf.messageView.frame = tableViewFrame;
}];
}
- (void)dealloc {
[self.view removeKeyboardControl];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment