54 lines
1.2 KiB
Objective-C
54 lines
1.2 KiB
Objective-C
//
|
|
// GiGaNavTitileView.m
|
|
// GIGA
|
|
//
|
|
// Created by lianxiang on 2018/8/23.
|
|
// Copyright © 2018年 com.giga.ios. All rights reserved.
|
|
//
|
|
|
|
#import "GiGaNavTitileView.h"
|
|
|
|
@implementation GiGaNavTitileView
|
|
@synthesize titleStr = _titleStr;
|
|
@synthesize titleColor = _titleColor;
|
|
- (id)initWithString:(NSString *)str frame:(CGRect)frame
|
|
{
|
|
if (self = [super initWithFrame:frame]) {
|
|
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
|