4-16学习

 

tableView左边分割线的解决办法

 

(void) viewDidLoad {

/**

     *  tableView左边分割线短的解决办法

     */

    if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {

        [self.tableView setSeparatorInset:UIEdgeInsetsZero];

        }

    if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)]) {

        

        [self.tableView setLayoutMargins:UIEdgeInsetsZero];

        

    }

 

}

/*

    tableView代理方法

 */

//将要展示Cell视图回调

- (void) tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath

{

    /**

     *  tableView左边分割线短的解决办法

     */

    if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {

        

        [cell setSeparatorInset:UIEdgeInsetsZero];

        

    }

    

    if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {

        

        [cell setLayoutMargins:UIEdgeInsetsZero];

        

    }

}

 

// 选中状态的回调(选中了某个cell就会调用)

- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

{

    // 点击选中后,手指放开会由选中状态有动画的渐渐恢复非选中状态

    [self.tableView deselectRowAtIndexPath:indexPath animated:YES];

 

}

转载于:https://www.cnblogs.com/pocket-mood/p/4432896.html

你可能感兴趣的:(4-16学习)