Skip to content

Instantly share code, notes, and snippets.

@ngutman
Last active January 3, 2016 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ngutman/8483664 to your computer and use it in GitHub Desktop.
Save ngutman/8483664 to your computer and use it in GitHub Desktop.
#import "GGOverlayView.h"
@interface GGOverlayView ()
@property (nonatomic, strong) UIImageView *imageView;
@end
@implementation GGOverlayView
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (!self) return nil;
self.backgroundColor = [UIColor whiteColor];
self.imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"trollface_300x200"]];
[self addSubview:self.imageView];
return self;
}
- (void)setMode:(GGOverlayViewMode)mode
{
if (_mode == mode) return;
_mode = mode;
if (mode == GGOverlayViewModeLeft) {
self.imageView.image = [UIImage imageNamed:@"trollface_300x200"];
} else {
self.imageView.image = [UIImage imageNamed:@"thumbs_up_300x300"];
}
}
- (void)layoutSubviews
{
[super layoutSubviews];
self.imageView.frame = CGRectMake(50, 50, 100, 100);
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment