This commit is contained in:
lianxiang
2018-09-07 20:07:55 +08:00
parent 0f09748cc8
commit dc959b8ec0
59 changed files with 758 additions and 152 deletions
@@ -10,4 +10,8 @@
@interface GiGaNavTitileView : UIView
- (id)initWithString:(NSString *)str frame:(CGRect)frame;
@property(nonatomic,copy) NSString *titleStr;
@property(nonatomic,strong) UILabel *navlabel;
@property(nonatomic,strong) UIColor *titleColor;
@end
@@ -9,20 +9,45 @@
#import "GiGaNavTitileView.h"
@implementation GiGaNavTitileView
@synthesize titleStr = _titleStr;
@synthesize titleColor = _titleColor;
- (id)initWithString:(NSString *)str frame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, 44)];
label.textColor = [UIColor whiteColor];
label.text = str;
label.font = [UIFont fontWithName:@"PingFangSC-Medium" size:18.f];
label.textAlignment = NSTextAlignmentCenter;
[self addSubview:label];
self.titleStr = str;
[self creatTitle:frame];
}
return self;
}
-(instancetype)initWithFrame:(CGRect)frame{
if (self = [super initWithFrame:frame]) {
[self creatTitle:frame];
}
return self;
}
-(void)creatTitle:(CGRect)frame{
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, 44)];
label.textColor = [UIColor whiteColor];
label.text = self.titleStr;
label.font = [UIFont fontWithName:@"PingFangSC-Medium" size:18.f];
label.textAlignment = NSTextAlignmentCenter;
[self addSubview:label];
self.navlabel = label;
}
- (void)setTitleStr:(NSString *)titleStr{
_titleStr = titleStr;
self.navlabel.text = titleStr;
}
-(void)setTitleColor:(UIColor *)titleColor{
_titleColor = titleColor;
self.navlabel.textColor = _titleColor;
}
@end