音乐播放器项目一知识点总结

一.导航栏控制器的透明度设置

    //将navigationBar设为隐藏
    self.navigationController.navigationBar.hidden = YES;
    //将navigationBar设为半透明
    self.navigationController.navigationBar.translucent = NO;
    
    //让navigationbar变为全透明
    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"7.png"] forBarMetrics:UIBarMetricsCompact];

二.设置视图的毛玻璃效果

    //毛玻璃效果
    UIVisualEffectView *visuaview = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
    visuaview.frame = self.view.bounds;
    [myImage addSubview:visuaview];

三.设置表视图控制器或view的背景图片

  

    1.设置表视图控制器背景图片

    //设置tableView的背景图片
    UIImageView *myImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"1.jpg"]];
    myImage.frame = self.view.frame;
    self.tableView.backgroundView = myImage;

注意此时还要将cell的颜色清空.

 cell.backgroundColor = [UIColor clearColor]

 

   2.cell及其文本的其他属性

    //清空cell的背景色
    cell.backgroundColor = [UIColor clearColor];
    
    //取消选中样式
//    cell.selectionStyle = UITableViewCellSelectionStyleNone;

    //设置cell高亮状态的文字颜色
    cell.textLabel.highlightedTextColor = [UIColor colorWithRed:1.0 green:0 blue:0 alpha:1];
    
    cell.backgroundView = [[UIView alloc] init];
    //选中状态下的背景设为空(就是点击cell时的灰色清空)
    cell.selectedBackgroundView = [[UIView alloc] init];
    
//    cell.textLabel.font = [UIFont systemFontOfSize:22];
     //文本居中
    cell.textLabel.textAlignment = NSTextAlignmentCenter;
    

    3.取消cell的选中状态

//cell的点击事件
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    //取消cell选中状态
    [tableView deselectRowAtIndexPath:indexPath animated:YES];

}

      4.设置view的背景图片

    //设置背景图片
    UIImageView *myImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"1.jpg"]];
    myImage.frame = self.view.frame;
    [self.view addSubview:myImage];
    [self.view sendSubviewToBack:myImage];
     //要先清空原有颜色
    self.lyricTableView.backgroundColor = [UIColor clearColor];

  注意:在设置背景色之前要现将原有视图颜色清空,然后再去设置

四.取消tableView的cell之间的分割线

    //取消cell的分割线
    self.lyricTableView.separatorStyle = UITableViewCellSeparatorStyleNone;

 

五.View视图的圆角属性

    //将imageView设置圆角 (这两个属性一般就可以调节让视图变为圆形)
    _songImageView.layer.cornerRadius = CGRectGetWidth(_songImageView.frame)/2;
    _songImageView.layer.masksToBounds = YES;

注:
_layer.borderWidth = 10; //可以设置设置边框的大小

六.图片或视图的旋转

  //让songImageView旋转  弧度 = 角度*PI/180
    _songImageView.transform = CGAffineTransformRotate(_songImageView.transform, M_PI/90);

七.使用第三方解析图片时,对于图片占位符的使用

    //使用第三方解析图片   解析时自带图片占位符,如果没有加载出来的话,就显示占位符图片
    [self.songImageView sd_setImageWithURL:[NSURL URLWithString:music.picUrl] placeholderImage:[UIImage imageNamed:@"1.jpg"]];
原文地址:https://www.cnblogs.com/erdeng/p/4895339.html