首页 技术 正文
技术 2022年11月10日
0 收藏 980 点赞 5,153 浏览 4056 个字

<!–
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 16.0px Menlo; color: #ba0011; background-color: #c1ffbb}
–>
<!–
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 16.0px Menlo; color: #2e0d6e; background-color: #c1ffbb}
span.s1 {font: 17.0px Menlo; color: #000000}
span.s2 {color: #b40062}
span.s3 {color: #448993}
span.s4 {color: #ba0011}
–>

[self.tableView addObserver:self forKeyPath:@”contentOffset” options:NSKeyValueObservingOptionOld|NSKeyValueObservingOptionNew context:nil];

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context{
CGPoint oldPoint = [change[@"old"] CGPointValue];
CGPoint newPoint = [change[@"new"] CGPointValue];
// NSLog(@"%@",change);
CGFloat newY = newPoint.y;
CGFloat oldY = oldPoint.y;
if ( newY - oldY > 0) { //判断 self.imageView.y -= newY; self.tableView.y = self.imageView.bottom; [self.tableView setContentOffset:CGPointMake(, )]; }
else if ( newY - oldY < ) {
// self.imageView.y = self.imageView.y - newY;
// if (self.imageView.y >= 0) {
// self.imageView.y = 0;
// }
// self.tableView.y = self.imageView.bottom;
self.imageView.y -= newY; self.tableView.y = self.imageView.bottom; [self.tableView setContentOffset:CGPointMake(, )]; }}

https://github.com/yongliangP/YLSpringHeader

https://github.com/Cloudox/ScrollShowHeaderDemo

https://www.jianshu.com/p/8e4ed860d460

section 圆角 阴影

https://www.cnblogs.com/yeng/p/10540167.html

//===============Cell==================@interface SubCell : UITableViewCell@property (nonatomic, strong) SubCellShadowView *bgView;@property (nonatomic, strong) NSIndexPath *indexPath;@property (nonatomic) NSInteger rowInSection;//每一组的行数@end@implementation SubCell- (void)awakeFromNib {    [super awakeFromNib];    self.selectionStyle = UITableViewCellSelectionStyleNone;    self.clipsToBounds = NO;    SubCellShadowView *bgView = [[SubCellShadowView alloc] init];    [self insertSubview:bgView atIndex:];    self.bgView= bgView;    CAShapeLayer *shadow = [CAShapeLayer layer];    shadow.shadowColor = [UIColor blackColor].CGColor;    shadow.shadowOffset=CGSizeMake(,);    shadow.shadowOpacity=0.15;    [bgView.layeraddSublayer:shadow];    bgView.shadowLayer= shadow;    CALayer*line = [CALayerlayer];    line.backgroundColor = [UIColor groupTableViewBackgroundColor].CGColor;    [bgView.layeraddSublayer:line];    bgView.separatorLine= line;}-(void)layoutSubviews{    [super layoutSubviews];    UIBezierPath*bgBezierPath =nil;    CGFloat cornerRaduis =7.0;//觉得阴影大的可以把半径调小,半径大的话阴影面积会变大    if(self.indexPath.row== && self.rowInSection==) {//单组单行        self.bgView.clipsToBounds=NO;        self.bgView.frame=self.bounds;        CGRect rect = UIEdgeInsetsInsetRect(self.bgView.bounds, UIEdgeInsetsMake(, , , ));        bgBezierPath = [UIBezierPath bezierPathWithRoundedRect:rect byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(cornerRaduis, cornerRaduis)];    }elseif(self.indexPath.row==) {// 第一行        self.bgView.clipsToBounds=YES;        self.bgView.frame = UIEdgeInsetsInsetRect(self.bounds, UIEdgeInsetsMake(-, , , ));        CGRect rect = UIEdgeInsetsInsetRect(self.bgView.bounds, UIEdgeInsetsMake(, , , ));        bgBezierPath = [UIBezierPath bezierPathWithRoundedRect:rect byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight) cornerRadii:CGSizeMake(cornerRaduis, cornerRaduis)];    }elseif(self.indexPath.row==self.rowInSection-) {// 最后一行        self.bgView.clipsToBounds=YES;        self.bgView.frame = UIEdgeInsetsInsetRect(self.bounds, UIEdgeInsetsMake(, , -, ));        CGRect rect = UIEdgeInsetsInsetRect(self.bgView.bounds, UIEdgeInsetsMake(, , , ));        bgBezierPath = [UIBezierPath bezierPathWithRoundedRect:rect byRoundingCorners:(UIRectCornerBottomLeft|UIRectCornerBottomRight)  cornerRadii:CGSizeMake(cornerRaduis, cornerRaduis)];    }else{// 中间行        self.bgView.clipsToBounds=YES;        self.bgView.frame = UIEdgeInsetsInsetRect(self.bounds, UIEdgeInsetsMake(, , , ));        CGRect rect = UIEdgeInsetsInsetRect(self.bgView.bounds, UIEdgeInsetsMake(, , , ));        bgBezierPath = [UIBezierPathbezierPathWithRect:rect];    }    self.bgView.shadowLayer.path= bgBezierPath.CGPath;    self.bgView.shadowLayer.shadowPath= bgBezierPath.CGPath;    self.bgView.shadowLayer.fillColor = [UIColor whiteColor].CGColor;    //分割线 非单组单行 非最后一行    if(!(self.indexPath.row==&&self.rowInSection==) && !(self.indexPath.row==self.rowInSection-)) {        self.bgView.separatorLine.frame = CGRectMake(self.bgView.frame.origin.x+, self.bgView.frame.size.height-, self.bgView.frame.size.width-*, 1.0);    }}@end
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,088
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,564
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,412
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,185
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,822
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,905