码迷,mamicode.com
首页 > 其他好文 > 详细

tableview适配

时间:2014-06-22 23:54:13      阅读:363      评论:0      收藏:0      [点我收藏+]

标签:class   blog   com   width   os   set   

//#define IOS7_OR_LATER   ( [[[UIDevice currentDevice] systemVersion] compare:@"7.0"] != NSOrderedAscending )

- (void)setFrame:(CGRect)frame {
    if (IOS7_OR_LATER) {
        NSInteger inset = 10;
        frame.origin.x += inset;
        frame.size.width -= 2 * inset;
    }
   [super setFrame:frame];
}

  

#pragma mark----------iOS7 适配----------
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
    // only one cell in section - must be rounded on top & bottom
    if (indexPath.row == 0 && indexPath.row == [tableView numberOfRowsInSection:indexPath.section]-1)
    {
        UIImageView   *testView2=[[UIImageView  alloc]init];
        testView2.image=[UIImage  imageNamed:@"白框1.png"];
        cell.backgroundView = testView2;
    }
    // 第一个 first cell - must be rounded on top
    else if (indexPath.row == 0)
    {
        //        cell.top    = YES;
        //        cell.bottom = NO;
        UIImageView   *testView2=[[UIImageView  alloc]init];
        testView2.image=[UIImage  imageNamed:@"白框上.png"];
        cell.backgroundView = testView2;
    }
    //最后一个  last cell - must be rounded on bottom
    else if (indexPath.row == [tableView numberOfRowsInSection:indexPath.section]-1)
    {
        //        cell.top    = NO;
        //        cell.bottom = YES;
        UIImageView   *testView2=[[UIImageView  alloc]init];
        testView2.image=[UIImage  imageNamed:@"白框下.png"];
        cell.backgroundView = testView2;
    }
    else
    {
        //        cell.top    = NO;
        //        cell.top    = NO;
        UIImageView   *testView2=[[UIImageView  alloc]init];
        testView2.image=[UIImage  imageNamed:@"k2.png"];
        cell.backgroundView = testView2;
    }
}

  

tableview适配,布布扣,bubuko.com

tableview适配

标签:class   blog   com   width   os   set   

原文地址:http://www.cnblogs.com/hl666/p/3800035.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!