刷新表某一行和块,实现颜色渐变

来源:互联网 发布:笔记本mac地址可以改吗 编辑:程序博客网 时间:2024/04/28 08:35
  1. #import <QuartzCore/QuartzCore.h>  
  1. CAGradientLayer *gradient = [CAGradientLayer layer];  
  2. gradient.frame = rect;  
  3. gradient.colors = [NSArray arrayWithObjects:(id)[UIColor blackColor].CGColor,   
  4.                                             (id)[UIColor grayColor].CGColor,   
  5.                                             (id)[UIColor blackColor].CGColor,nil];  
  6. [self.layer insertSublayer:gradient atIndex:0];  

//一个section刷新    
NSIndexSet *indexSet=[[NSIndexSet alloc]initWithIndex:2];   
[tableview reloadSections:indexSetwithRowAnimation:UITableViewRowAnimationAutomatic];   
//一个cell刷新    
NSIndexPath *indexPath=[NSIndexPath indexPathForRow:3inSection:0];    
[tableView reloadRowsAtIndexPaths:[NSArrayarrayWithObjects:indexPath,nil]withRowAnimation:UITableViewRowAnimationNone]; 

0 0