Closed nanom1t closed 8 years ago
The error message is quite clear... Your "segmentedPager" variable is of Type MainController which has no method "setPages"
On Thu, Jan 28, 2016 at 1:57 PM, nanom1t notifications@github.com wrote:
Hello
I'm trying to get setup THSegmentedPager, but I get this error: -[MainController setPages:]: unrecognized selector sent to instance 0x176740e0 2016-01-28 14:51:26453 SecretName[4594:882192] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MainController setPages:]: unrecognized selector sent to instance 0x176740e0' * First throw call stack: (0x23bf90d7 0x3208bc77 0x23bfe59d 0x23bfc479 0x23b2b708 0xca46b 0x272c5c85 0x274bc26b 0x274be90f 0x274c95e9 0x274bd0c7 0x2a6cdec1 0x23bbf035 0x23bbe2f9 0x23bbce53 0x23b086d1 0x23b084e3 0x272bf867 0x272ba445 0xcb75d 0x32659aaf)
I use this code to initialization: ` //init app pages THSegmentedPager segmentedPager = (THSegmentedPager )((UINavigationController )selfwindowrootViewController)topViewController; NSMutableArray segmentedPages = [NSMutableArray new];
MainController *mainController = [segmentedPagerstoryboard instantiateViewControllerWithIdentifier:@"MainController"]; if(mainController) { [segmentedPages addObject:mainController]; NSLog(@"Loaded"); }
[segmentedPager setPages:segmentedPages];
`
Thanks
— Reply to this email directly or view it on GitHub https://github.com/hons82/THSegmentedPager/issues/23.
Thanks for answer.
Yes, it is true - MainController has no method setPages, because it my own controller. I'm just trying to integrate THSegmentedPager into my app, so I used code examples from this repository (https://github.com/hons82/THSegmentedPager). I have also looked at code examples here https://github.com/hons82/THSegmentedPager/tree/master/THSegmentedPagerExample/THSegmentedPagerExample and it looks like SamplePagedViewController has no method "setPages" too.
Maybe you have any working example or tutorial "How to use THSegmentedPager in real project"?
Thanks
You're right. SamplePagedViewController" has no setPages method, and thats correct like that, because it is one of the PAGES and not the PAGER.
The Sample contains two ways of loading pages into the pager as you can see here . One by adding viewcontrollers, the second is just taking identifiers from the storyboard depending on the flag set in the settings.
Did you ever try to download the repo and run the sample? In the debugger you should see everything you need.
Thanks. I have just fixed all bugs and it looks fine.
How can I set the background color of selected segment or get access to it layer? I want to get something like here:
Hi @nanom1t, I'm facing the same issue. Can you tell me how you fixed this? Thank in advance
Its not crashing for me on setPages because I did this in .h file:
@interface MyCustomeViewController : THSegmentedPager
And I have added 2 viewcontrollers but still my page is empty.
Hello.
I'm trying to get setup THSegmentedPager, but I get this error:
-[MainController setPages:]: unrecognized selector sent to instance 0x176740e0 2016-01-28 14:51:26.453 SecretName[4594:882192] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MainController setPages:]: unrecognized selector sent to instance 0x176740e0' *** First throw call stack: (0x23bf90d7 0x3208bc77 0x23bfe59d 0x23bfc479 0x23b2b708 0xca46b 0x272c5c85 0x274bc26b 0x274be90f 0x274c95e9 0x274bd0c7 0x2a6cdec1 0x23bbf035 0x23bbe2f9 0x23bbce53 0x23b086d1 0x23b084e3 0x272bf867 0x272ba445 0xcb75d 0x32659aaf)
I use this code to initialization:
//init app pages THSegmentedPager *segmentedPager = (THSegmentedPager *)((UINavigationController *)self.window.rootViewController).topViewController; NSMutableArray *segmentedPages = [NSMutableArray new]; MainController *mainController = [segmentedPager.storyboard instantiateViewControllerWithIdentifier:@"MainController"]; if(mainController) { [segmentedPages addObject:mainController]; NSLog(@"Loaded"); } [segmentedPager setPages:segmentedPages];
Thanks