jezzmemo / jjstockview Goto Github PK
View Code? Open in Web Editor NEWiOS股票,课程表,表格控件
License: MIT License
iOS股票,课程表,表格控件
License: MIT License
看了下代码
(BOOL)touchesShouldCancelInContentView:(UIView *)view
{
if ( [view isKindOfClass:[UIButton class]] ) {
return YES;
}
return [super touchesShouldCancelInContentView:view];
}
这么处理的,但是感觉还是延迟。
另外查了下,有些是这么处理的
//传递touch事件
(void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event
{
if(!self.dragging)
{
[[self nextResponder] touchesBegan:touches withEvent:event];
}
[super touchesBegan:touches withEvent:event];
// NSLog(@"MyScrollView touch Began");
}
(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
if(!self.dragging)
{
[[self nextResponder] touchesMoved:touches withEvent:event];
}
[super touchesMoved:touches withEvent:event];
}
(void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event
{
if(!self.dragging)
{
[[self nextResponder] touchesEnded:touches withEvent:event];
}
[super touchesEnded:touches withEvent:event];
}
但是还是不行,之前没有做过这种类似的需求,请问这个是不是属于bug,或者有什么好办法吗?
JJStockView.m 第100行代码处:
发现在cell的block中直接引用tableView会造成内存泄漏,这是我更改后的代码
__weak typeof(self) weakSelf = self;
//FIXME:tableView有内存泄漏
__weak typeof(tableView) weakTableView = tableView;
[cell setRightContentTapBlock:^(JJStockViewCell* cell){
__strong typeof(self) strongSelf = weakSelf;
NSIndexPath* indexPath = [weakTableView indexPathForCell:cell];
if ([strongSelf.delegate respondsToSelector:@selector(didSelect:atRowPath:)]) {
[strongSelf.delegate didSelect:strongSelf atRowPath:indexPath.row];
}
}];
解决了
能不能有一行行的点击事件,不要一竖竖的点击事件
用的websocket,每次推过来的是部分数据,更新数据显示在tableview里呢,如果用reloaddata的话,整体会更新
JJStockView第158处复用有问题, 重复调用 reloadStockView 会创建多个titleView,建议改成:
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UIView *headerView = [self.stockTableView dequeueReusableHeaderFooterViewWithIdentifier:@"headView"];
if (!headerView) {
headerView = [[UITableViewHeaderFooterView alloc] initWithReuseIdentifier:@"headView"];
headerView.frame = CGRectMake(0, 0, self.bounds.size.width, 40);
headerView.backgroundColor = [UIColor whiteColor];
}
CGFloat regularWidth = 0.0f;
CGFloat headHeight = 0.0f;
if([self.delegate respondsToSelector:@selector(headRegularTitle:)]){
UIView* regularView = [self.delegate headRegularTitle:self];
[headerView addSubview:regularView];
regularWidth = CGRectGetWidth(regularView.frame);
}
if([self.delegate respondsToSelector:@selector(heightForHeadTitle:)]){
headHeight = [self.delegate heightForHeadTitle:self];
}
[headerView addSubview:self.headScrollView];
self.headScrollView.frame = CGRectMake(regularWidth,0,CGRectGetWidth(self.frame) - regularWidth,headHeight);
if([self.delegate respondsToSelector:@selector(headTitle:)]){
// 移除原有的,避免重复添加
UIView *titleView = [self.headScrollView viewWithTag:10000];
if (titleView) {
[titleView removeFromSuperview];
}
UIView* newTitleView = [self.delegate headTitle:self];
newTitleView.tag = 10000;
[self.headScrollView addSubview:newTitleView];
self.headScrollView.contentSize = CGSizeMake(CGRectGetWidth(titleView.frame), headHeight);
}
return headerView;
}
有俩问题
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.