Skip to content

Instantly share code, notes, and snippets.

@dylan
Created February 15, 2011 23:27
Show Gist options
  • Save dylan/828509 to your computer and use it in GitHub Desktop.
Save dylan/828509 to your computer and use it in GitHub Desktop.
Fuzzy Description code...
-(id)initWithFrame:(CGRect)frame {
if ((self = [super initWithFrame:frame])) {
CGSize winSize;
NSAutoreleasePool *pool;
UIImage *dImg, *cImg;
pool = [NSAutoreleasePool new];
winSize = [[CCDirector sharedDirector] winSize];
_cView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)] autorelease];
_bg = [[[UIImageView alloc] initWithFrame:CGRectZero] autorelease];
_btmBar = [[[UIImageView alloc] initWithFrame:CGRectZero] autorelease];
_desc = [[[UIImageView alloc] initWithFrame:CGRectZero] autorelease];
_bg.image = [UIImage imageNamed:@"deploy-description.png"];
_btmBar.image = [UIImage imageNamed:@"deploy-bottom.png"];
_budget = [[[UILabel alloc] initWithFrame:CGRectZero] autorelease];
_height = _bg.image.size.height;
_budget.textColor = [UIColor colorWithWhite:1.0f alpha:1.0f];
_dBtn = [UIButton buttonWithType:UIButtonTypeCustom];
_cBtn = [UIButton buttonWithType:UIButtonTypeCustom];
dImg = [UIImage imageNamed:@"btn-deploy.png"];
cImg = [UIImage imageNamed:@"btn-cancel.png"];
_bg.frame = CGRectMake(0.0f, 0.0f, _bg.image.size.width, _bg.image.size.height);
_btmBar.frame = CGRectMake(0.0f, _bg.image.size.height, _btmBar.image.size.width, _btmBar.image.size.height);
_budget.frame = CGRectMake(frame.size.width/4, _btmBar.frame.origin.y+(_btmBar.image.size.height-dImg.size.height)/2, frame.size.width/2, dImg.size.height);
_dBtn.frame = CGRectMake(_btmBar.image.size.width-15-dImg.size.width, _btmBar.frame.origin.y + (_btmBar.image.size.height-dImg.size.height)/2, dImg.size.width, dImg.size.height);
_cBtn.frame = CGRectMake(15.0f, _btmBar.frame.origin.y + (_btmBar.image.size.height-cImg.size.height)/2, cImg.size.width, cImg.size.height);
_desc.frame = CGRectMake((_bg.frame.size.width/2)+470, (_bg.frame.size.height/2)+130, 470, 130);
[_dBtn setImage:dImg forState:UIControlStateNormal];
[_cBtn setImage:cImg forState:UIControlStateNormal];
_dBtn.backgroundColor = [UIColor colorWithWhite:1.0f alpha:0.0f];
_cBtn.backgroundColor = [UIColor colorWithWhite:1.0f alpha:0.0f];
_budget.backgroundColor = [UIColor colorWithWhite:1.0f alpha:0.0f];
_budget.textAlignment = UITextAlignmentCenter;
_desc.contentMode = UIViewContentModeLeft;
self.contentMode = UIViewContentModeLeft;
self.autoresizingMask = UIViewAutoresizingNone;
self.clipsToBounds = YES;
[_cView addSubview:_bg];
[_cView addSubview:_btmBar];
[_cView addSubview:_dBtn];
[_cView addSubview:_cBtn];
[_cView addSubview:_budget];
[_cView addSubview:_desc];
[self addSubview:_cView];
[pool drain];
}
return self;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment