Open luyud opened 8 years ago
// ====================== ZJ添加:修正xib控件显示角标位置不正确问题 ======================
(void)load { [super load]; Method m1 = class_getInstanceMethod(self, @selector(layoutSubviews)); Method m2 = class_getInstanceMethod(self, @selector(zj_layoutSubviews)); method_exchangeImplementations(m1, m2); }
(void)zj_layoutSubviews { [self zj_layoutSubviews]; self.badge.center = CGPointMake(CGRectGetWidth(self.frame) + 2 + self.badgeCenterOffset.x, self.badgeCenterOffset.y); }
// ====================== end ======================
// ====================== ZJ添加:修正xib控件显示角标位置不正确问题 ======================
(void)load { [super load]; Method m1 = class_getInstanceMethod(self, @selector(layoutSubviews)); Method m2 = class_getInstanceMethod(self, @selector(zj_layoutSubviews)); method_exchangeImplementations(m1, m2); }
(void)zj_layoutSubviews { [self zj_layoutSubviews]; self.badge.center = CGPointMake(CGRectGetWidth(self.frame) + 2 + self.badgeCenterOffset.x, self.badgeCenterOffset.y); }
// ====================== end ======================
这个是写在哪里的?请教大佬
我的TableViewCell使用xib自动布局, 当xib中的cell高度和代码中不一致时,WZLBadge显示的位置会以xib中的为准,同样的Label使用自动布局时也无法根据文字长度更新badge位置。