我已经自定义 UIView 来创建自定义 UI 组件。
视图的层次结构是这样的。
----自定义UIView
----------------UIScrollView
----------------------------- ScrollView 中的子视图
-(id)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if(self){
//Allocation and Initialization of ScrollView
//...
[super addSubView:scrollView];
}
return self;
}
- (void)layoutSubviews {
DLog(@"%@",[NSThread callStackSymbols]);
[super layoutSubviews];
[self reloadData];
}
//This method can be used to reload the entire control
-(void)reloadData{
//Reload the subviews of control
}
当滚动视图滚动时,layoutSubviews 方法在 iOS 版本 4.3 中被调用。但是对于 4.3 (5.0 , 6.0) 以上的版本,不会调用此事件处理程序。
在我的用例中,我不希望 layoutsubviews 被调用。
如何确保在滚动时我有一个不会触发 layoutsubviews 方法的滚动视图?