|
@@ -9,6 +9,10 @@
|
|
|
|
|
|
@interface GroupIntroduceBodyView ()<UITextViewDelegate>
|
|
|
|
|
|
+@property (weak, nonatomic) IBOutlet UILabel *tipsLabel;
|
|
|
+
|
|
|
+@property (weak, nonatomic) IBOutlet UILabel *countLabel;
|
|
|
+
|
|
|
@property (weak, nonatomic) IBOutlet UITextView *inputView;
|
|
|
|
|
|
@property (nonatomic, copy) GroupIntroduceModifyCallback callback;
|
|
@@ -18,6 +22,10 @@
|
|
|
|
|
|
@implementation GroupIntroduceBodyView
|
|
|
|
|
|
+- (void)awakeFromNib {
|
|
|
+ [super awakeFromNib];
|
|
|
+ self.inputView.delegate = self;
|
|
|
+}
|
|
|
|
|
|
+ (instancetype)sharedInstance {
|
|
|
GroupIntroduceBodyView *view = [[[NSBundle mainBundle] loadNibNamed:@"GroupIntroduceBodyView" owner:nil options:nil] firstObject];
|
|
@@ -25,8 +33,30 @@
|
|
|
}
|
|
|
|
|
|
- (void)configWithDesc:(NSString *)introduceString callback:(GroupIntroduceModifyCallback)callback {
|
|
|
+ if (callback) {
|
|
|
+ self.callback = callback;
|
|
|
+ }
|
|
|
+ self.countLabel.text = [NSString stringWithFormat:@"%zd/200", introduceString.length];
|
|
|
+ self.tipsLabel.hidden = [NSString isEmptyString:introduceString] ? NO : YES;
|
|
|
|
|
|
-
|
|
|
+ NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init];
|
|
|
+ paragraphStyle.lineSpacing = 4.0f;
|
|
|
+ UIFont *font = [UIFont systemFontOfSize:15 weight:UIFontWeightRegular];
|
|
|
+ if (![NSString isEmptyString:introduceString]) {
|
|
|
+ NSDictionary *attributes = @{NSFontAttributeName:font,NSParagraphStyleAttributeName:paragraphStyle,NSForegroundColorAttributeName:HexRGB(0x333333)};
|
|
|
+ self.inputView.attributedText = [[NSAttributedString alloc] initWithString:introduceString attributes:attributes];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+- (IBAction)saveAction:(id)sender {
|
|
|
+ [self endEditing:YES];
|
|
|
+ if (self.callback) {
|
|
|
+ if ([NSString isEmptyString:self.inputView.text]) {
|
|
|
+ [LOADING_MANAGER MBShowAUTOHidingInWindow:@"请输入标题"];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ self.callback(self.inputView.text);
|
|
|
+ }
|
|
|
}
|
|
|
/*
|
|
|
// Only override drawRect: if you perform custom drawing.
|