Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSInvalidArgumentException', reason: '-[UITableView setSeparatorInset:]: unrecognized selector sent to instance

The following in viewWillAppear

    [SYPTableView setSeparatorInset:UIEdgeInsetsZero];

Works fine on iOS 7 but on 6.1 it raised the exception :

    NSInvalidArgumentException', reason: '-[UITableView setSeparatorInset:]: unrecognized selector sent to instance 

My purpose is to remove the cell border.

like image 461
Nabil Sham Avatar asked Nov 04 '13 06:11

Nabil Sham


1 Answers

The separatorInset property is available on UITableView from iOS 7.0 and that's why you get the exception on iOS 6.1.

From the code you posted it looks like you want to remove the default inset introduced in iOS 7. Such inset is not present in iOS 6, so you only have to remove the inset in iOS 7.

You can check whether the table view responds to setSeparatorInset: doing

if ([SVPTableView respondsToSelector:@selector(setSeparatorInset:)]) {
    [SYPTableView setSeparatorInset:UIEdgeInsetsZero];
}
like image 130
Gabriele Petronella Avatar answered Oct 16 '22 22:10

Gabriele Petronella