Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // FloatBox.m
- // Jell
- //
- // Created by Admin on 9/15/14.
- // Copyright (c) 2014 ___LEZGRO___. All rights reserved.
- //
- #import "FloatBox.h"
- @implementation FloatBox
- - (instancetype)initWithFrame:(CGRect)frame
- title:(NSString *)title
- subTitle:(NSString *)subTitle
- {
- self = [self initWithFrame:frame];
- if (self) {
- CGFloat titleLabelHeight = 20.0;
- CGFloat subTitleLabelOfsetY = 20.0;
- CGFloat fontSize = 10.0;
- CGFloat floatBoxBorderWidth = 1.0;
- self.backgroundColor = [UIColor whiteColor];
- UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.frame), titleLabelHeight)];
- titleLabel.text = title;
- titleLabel.font = [UIFont systemFontOfSize:fontSize];
- titleLabel.textAlignment = NSTextAlignmentCenter;
- titleLabel.textColor = [UIColor greenColor];
- UILabel *subTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, subTitleLabelOfsetY, CGRectGetWidth(self.frame), titleLabelHeight)];
- subTitleLabel.text = subTitle;
- subTitleLabel.font = [UIFont systemFontOfSize:fontSize];
- subTitleLabel.textAlignment = NSTextAlignmentCenter;
- titleLabel.textColor = [UIColor greenColor];
- [self addSubview:titleLabel];
- [self addSubview:subTitleLabel];
- [self.layer setBorderColor:[UIColor greenColor].CGColor];
- [self.layer setBorderWidth:floatBoxBorderWidth];
- [self sizeToFit];
- }
- return self;
- }
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement