// // UIView+XIB.m // HCQuanfangtong // // Created by qft_Ios_03 on 2018/5/18. // Copyright © 2018年 qft_Ios_03. All rights reserved. // #import "UIView+XIB.h" #import @implementation UIView (XIB) + (instancetype )replyViewFirst{ [[self class] fixTextViewCrash]; NSArray *array = [[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:nil options:nil]; UIView *v = [array firstObject]; return v; } +(void)fixTextViewCrash { if (@available(iOS 13.2,*)) { }else{ const char *className = "_UITextLayoutView"; Class clas = objc_getClass(className); if (clas == nil) { clas = objc_allocateClassPair([UIView class], className, 0); objc_registerClassPair(clas); } } } - (void)setIsFold:(int)isFold{ objc_setAssociatedObject(self, @"isFold", [NSNumber numberWithBool:isFold], OBJC_ASSOCIATION_ASSIGN); } - (int)isFold{ return [objc_getAssociatedObject(self, @"isFold") boolValue]; } - (void)setUpdateAudit:(void (^)(NSString *remark,UIView *sender))updateAudit{ objc_setAssociatedObject(self, @"updateAudit", updateAudit, OBJC_ASSOCIATION_COPY); } - (void (^)(NSString *remark,UIView *sender))updateAudit{ return objc_getAssociatedObject(self, @"updateAudit"); } - (void)setChangeClick:(void (^)(NSInteger))ChangeClick{ objc_setAssociatedObject(self, @"ChangeClick", ChangeClick, OBJC_ASSOCIATION_COPY); } - (void (^)(NSInteger))ChangeClick{ return objc_getAssociatedObject(self, @"ChangeClick"); } - (void)setUpdateObj:(id)updateObj{ objc_setAssociatedObject(self, @"updateObj", updateObj, OBJC_ASSOCIATION_COPY); } - (void)setSaleType:(NSString *)saleType { objc_setAssociatedObject(self, @"saleType", saleType, OBJC_ASSOCIATION_COPY); } - (id)updateObj{ return objc_getAssociatedObject(self, @"updateObj"); } @end