Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UITableViewCell中添加位置不对 #67

Open
kaqise opened this issue Oct 26, 2018 · 2 comments
Open

UITableViewCell中添加位置不对 #67

kaqise opened this issue Oct 26, 2018 · 2 comments

Comments

@kaqise
Copy link

kaqise commented Oct 26, 2018

  • (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    CustomTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CustomTableViewCell" forIndexPath:indexPath];
    [cell.avator showBadge];
    return cell;
    }

2018-10-26 3 33 01

@zj381652512
Copy link

// ====================== 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 ======================

@qy0827a
Copy link

qy0827a commented Mar 20, 2019

  • (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);
    }

请问这个是写在哪个方法里面呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants