我是找到一種方式,Facebook的2個UItableviewcells之間添加空間一樣,發現了一個解決方案查收下面的代碼目標C - 兩個tableview中細胞間給予空間IOS
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
cell.contentView.backgroundColor = [UIColor whiteColor];
UIView *whiteRoundedView = [[UIView alloc]initWithFrame:CGRectMake(8, 8, self.view.frame.size.width-18, cell.contentView.frame.size.height - 18)];
CGFloat colors[]={1.0,1.0,1.0,1.0};//cell color white
whiteRoundedView.layer.backgroundColor = CGColorCreate(CGColorSpaceCreateDeviceRGB(), colors);
whiteRoundedView.layer.masksToBounds = false;
whiteRoundedView.layer.cornerRadius = 5.0;
whiteRoundedView.layer.shadowOffset = CGSizeMake(-1, 1);
whiteRoundedView.layer.shadowOpacity = 0.3;
whiteRoundedView.layer.shadowColor = [UIColor lightGrayColor].CGColor;
[cell.contentView addSubview:whiteRoundedView];
[cell.contentView sendSubviewToBack:whiteRoundedView];}
這段代碼是給我的輸出我想,但問題是 它一次又一次地呼籲,使我的應用程序緩慢,因爲我滾動tablview 和陰影也在不斷增加,我向下滾動 誰能幫助我解決這個問題?
你可以在UITableViewCell的底部添加的UIView,這將不會影響性能。 –
選中此:https://stackoverflow.com/questions/17490203/how-to-create-paddingspacing-between-rows-in-tablview/17490283#17490283 – brianLikeApple