您的位置:首页 > 产品设计 > UI/UE

iOS之设置tableView背景图片/让UITableView自动滑动(定位)到某一行cell

2015-11-10 09:41 996 查看
给tableView设置背景图片

1.给tableView设置背景view 


  
UIImageView *backImageView=[[UIImageViewalloc]initWithFrame:self.view.bounds]; 

   
[backImageView setImage:[UIImageimageNamed:@
"liaotianbeijing"
]]; 

    
self.tableView.backgroundView=backImageView; 

  
 
2.让cell透明 

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 




   
MyCell  *cell = [tableViewdequeueReusableCellWithIdentifier:@
"METext"
forIndexPath:indexPath]; 

    
cell.backgroundColor=[UIColor clearColor];
//关键语句 

    
[cell setCellInfo:dic];
//自定义类目方法 


     
return

cell; 


}


让UITableView自动滑动(定位)到某一行cell

NSIndexPath *scrollIndexPath = [NSIndexPath indexPathForRow:10 inSection:0];

[[self tableView] scrollToRowAtIndexPath:scrollIndexPath

        atScrollPosition:UITableViewScrollPositionTop animated:YES];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息