美文网首页
iOS实战之特效

iOS实战之特效

作者: SuAdrenine | 来源:发表于2017-03-19 15:22 被阅读74次

特效一:给View加阴影

view.layer.shadowColor = [UIColor blackColor].CGColor;
view.layer.shadowOffset =  CGSizeMake(0, 0.5);
view.layer.shadowOpacity = 0.2;//阴影透明度,默认0
view.layer.shadowRadius = 1;//阴影半径,默认3

特效二:cell长按阴影

1)、去除长按效果
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    // 1 松开手选中颜色消失   
   [tableView deselectRowAtIndexPath:indexPath animated:YES];
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    // 2
    [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
    // 3点击没有颜色改变
    cell.selected = NO;
}
2)、更换长按效果以及颜色:
UIColor *color =  [[UIColor alloc]initWithRed:0.0green:0.0blue:0.0alpha:1];
//通过RGB来定义自己的颜色
 cell.selectedBackgroundView = [[[UIView alloc] initWithFrame:cell.frame] autorelease];         
 cell.selectedBackgroundView.backgroundColor = [UIColor color];

参考:iOS UITableViewCell选中效果颜色设置

3)、高阶特效参考:

参考:一个波纹阴影点击和长按效果的TableViewCell


特效三:导航栏颜色与透明度渐变

参考文章:
iOS监听UIScrollView使导航栏透明度渐变
几句话实现导航栏透明渐变-iOS
Navigation Bar 渐隐动画实现

相关文章

网友评论

      本文标题:iOS实战之特效

      本文链接:https://www.haomeiwen.com/subject/mwgmnttx.html