Search code examples
iosobjective-cuitableviewios6

No visible @interface for UItableview declares the selector setSeparatorInset


My question is simply the title. I don't understand that if I'm using respondsToSelector why is the code checks for actual implementation ? I'm on iOS 6, XCode 4.6

warning and error


Solution

  • I got the answer to my question:

    So this has something to do with the theory than iOS or XCode version. Compiler at the time of compilation (of code) checks for the existence of method and since setSeparatorInset is not part of iOS 6.x it will not work b/c compilers don't check for 'if' clauses it simply compiles the code. 'if' clause will be evaluated at runtime. So I'm trying to call the method which isn't there simply BUT what I was trying to achieve is not wrong, it can be done and I can check for method of iOS 7 from code of iOS 6. What I have to do is

    [tableView performSelector:@selector()];
    

    This perform selector (is part of tableView) is executed at runtime and I'm not directly calling the method at compile time that's why this will work.