We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Bug 表现 QMUITableViewCell 初始化方法
- (instancetype)initForTableView:(UITableView *)tableView withStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self.initByTableView = YES; if (self = [self initWithStyle:style reuseIdentifier:reuseIdentifier]) { self.parentTableView = tableView; [self didInitializeWithStyle:style];// 因为设置了 parentTableView,样式可能都需要变,所以这里重新执行一次 didInitializeWithStyle: 里的 qmui_styledAsQMUITableViewCell } return self; }
在swift中
final class DemoTableViewCell: QMUITableViewCell { let label = DemoLabel() }
label会被初始化两次,当退出页面时还有一个label存在于内存中
截图
如何重现 Demo.zip
预期的表现 如果调用super则表现正常
- (instancetype)initForTableView:(UITableView *)tableView withStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self.initByTableView = YES; if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { self.parentTableView = tableView; [self didInitializeWithStyle:style];// 因为设置了 parentTableView,样式可能都需要变,所以这里重新执行一次 didInitializeWithStyle: 里的 qmui_styledAsQMUITableViewCell } return self; }
其他信息
The text was updated successfully, but these errors were encountered:
已发布 4.4.0 修复该问题。
Sorry, something went wrong.
发现 4.4.0 的修改方式会导致以下问题:
业务某个 cell 继承自 QMUITableViewCell。当业务要重写 init 方法时,他沿用系统默认的思路,去重写 initWithStyle:reuseIdentifier: 方法,然后在业务 vc 里使用这个 cell 时又是用 QMUI 提供的 initForTableView:withStyle: 系列方法去初始化。
QMUITableViewCell
initWithStyle:reuseIdentifier:
initForTableView:withStyle:
如果这种场景,在升级到 4.4.0 后就会发现 initForTableView 调用时无法触发 cell 内部重写的 initWithStyle:。
已发布 4.4.1,回退该修改,这种情况目前暂无合适的建议,可以考虑业务换个写法。
No branches or pull requests
Bug 表现
QMUITableViewCell 初始化方法
在swift中
label会被初始化两次,当退出页面时还有一个label存在于内存中
截图
![image](https://user-images.githubusercontent.com/15374531/141936716-c1269f0c-58fb-4d4f-8ae1-ed42f8ab0984.png)
![image](https://user-images.githubusercontent.com/15374531/141936926-54e58ad7-0bc2-453a-9264-2dc9a353863f.png)
![image](https://user-images.githubusercontent.com/15374531/141936995-600ca123-ce28-4f29-aec9-16571ebf74aa.png)
如何重现
Demo.zip
预期的表现
如果调用super则表现正常
其他信息
The text was updated successfully, but these errors were encountered: