Skip to content

Instantly share code, notes, and snippets.

@anka
Created January 4, 2015 16:20
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
iOS camera overlay view
@implementation OverlayView
- (id)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
//clear the background color of the overlay
self.opaque = NO;
self.backgroundColor = [UIColor clearColor];
//load an image to show in the overlay
UIImage *searcher = [UIImage imageNamed:@"searcher.png"];
UIImageView *searcherView = [[UIImageView alloc]
initWithImage:searcher];
searcherView.frame = CGRectMake(30, 100, 260, 200);
[self addSubview:searcherView];
[searcherView release];
//add a simple button to the overview
//with no functionality at the moment
UIButton *button = [UIButton
buttonWithType:UIButtonTypeRoundedRect];
[button setTitle:@"Scan Now" forState:UIControlStateNormal];
button.frame = CGRectMake(0, 430, 320, 40);
[self addSubview:button];
}
return self;
}
...
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment