Skip to content

Instantly share code, notes, and snippets.

@runeleaf
Created March 10, 2013 13:59
Show Gist options
  • Save runeleaf/5128680 to your computer and use it in GitHub Desktop.
Save runeleaf/5128680 to your computer and use it in GitHub Desktop.
#import "HeaderView.h"
@implementation HeaderView
- (id)initWithFrame:(CGRect)frame invorked:(UIViewController *)controller
{
//UIView *imageArea;
//UILabel *titleArea;
//UIView *alpha;
//UIButton *playButton;
//UIViewController *invorkedController;
if ((self = [super initWithFrame:frame])) {
// super
}
//UIViewController *invorkedController = controller;
self.backgroundColor = [UIColor redColor];
//self.layer.shadowOpacity = 0.4;
self.layer.shadowOffset = CGSizeMake(0.0, -2.0);
UIView *alpha = [[UIView alloc] initWithFrame:CGRectMake(0, 60, self.frame.size.width, 5)];
alpha.backgroundColor = [UIColor redColor];
alpha.layer.shadowOpacity = 1.0;
alpha.layer.shadowOffset = CGSizeMake(0.0, 1.0);
[self addSubview:alpha];
UIView *imageArea = [[UIView alloc] initWithFrame:CGRectMake(5, 5, 50, 50)];
UIImage *image = [UIImage imageNamed:@"library.png"];
imageArea.backgroundColor = [UIColor colorWithPatternImage:image];
imageArea.layer.borderColor = [[UIColor alloc] initWithRed:0.3 green:0.3 blue:0.3 alpha:0.5].CGColor;
imageArea.layer.borderWidth = 1.0;
imageArea.layer.shadowOpacity = 0.2;
imageArea.layer.shadowOffset = CGSizeMake(2.0, 2.0);
[self addSubview:imageArea];
titleArea = [[UILabel alloc] initWithFrame:CGRectMake(70, 5, 190, 50)];
titleArea.backgroundColor = [UIColor redColor];
titleArea.font = [UIFont fontWithName:@"AppleGothic" size:16];
titleArea.numberOfLines = 0;
[self addSubview:titleArea];
UIImage *playImage = [UIImage imageNamed:@"play.png"];
UIButton *playButton = [[UIButton alloc] initWithFrame:CGRectMake(265, 5, 50, 50)];
//playButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
//playButton.frame = CGRectMake(50, 50, 150, 150);
[playButton setTitle:@"PlayPlayPlayPlay" forState:UIControlStateNormal];
[playButton addTarget:self action:@selector(play:) forControlEvents:UIControlEventTouchUpInside];
[playButton setBackgroundImage:playImage forState:UIControlStateNormal];
//[playButton setEnabled:TRUE];
[self addSubview:playButton];
return self;
}
- (void)play:(id)sender{
NSLog(@"ahoge");
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment