-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create controller programmatically throws exception #3
Comments
Hmm I see. I found where and why it's crashing and I'm thinking of how best to fix this. It crashes because it tries to calculate where to draw the underline before there are even any tabs loaded. For now I guess it's only usable via storyboard :/ Incidentally, UITabBarControllers always call their initWithNib from within their init methods. Try the same code you have only without subclassing BFPaperTabBarController and you will see, it will call its initWithNib from within init:
|
Yeah I have the same observation Thanks for that insight I suspect something similar earlier but just haven't got the time to test it out. I will just try to use a temporary hack for this for now and if you have any follow up(or there's anything I can help) please let me know |
I have to admit that I am not used to using TabBarController programmatically. I'm always open to accepting pull requests if you happen to figure out a good way to fix this. I will also keep looking into it but I can't promise any timeframe ;) |
That's fine. I will definitely pull request if I find good solution. Right now I'm just deleting that initWithNib for this control so that it won't be called |
@thisiscam Did you ever get this working programmatically? I tried deleting the initWithNib method with no luck |
You might want to diff with this https://github.com/thisiscam/BFPaperTabBarController/blob/master/Classes/BFPaperTabBarController.m ? I remember commenting out a few lines in init which was super hacky... |
Thanks for the quick response. I had a look at that’s basically what I did too. Not sure why mine isn’t working, I get no theming or ‘tap ripples’ or anything. Will have to try again when I have more time. On Sun, Oct 26, 2014 at 7:05 PM, Cambridge notifications@github.com
|
If it's not too late, I've modified this class to work programmatically! You can check out the source here! I basically removed all references to IB and refactored/reorganized some of the initialization methods. Now it works like a charm without IB! https://github.com/Timstarockz/BFPaperTabBarController/tree/master/Classes |
@Timstarockz Thank you! |
@Timstarockz Thanks! I'll take a closer look next week and perhaps make this the standard. |
@bfeher so rite now with the latest version, init tab bar controller programmatically is possible? |
@tobatha It hasn't been integrated into the main branch, so please use Timstarockz version above. Thank you. |
@bfeher yeah, i tried last nite, seems no luck, but won't crash anymore, that's very reassuring! ^_^ |
@tobatha I'm sorry that I have been criminally negligent of my repos lately. Life is getting too busy. If you find anything that needs fixed please let me know and I will try to fix it ASAP :) |
I'm experimenting with this controller and figured that it raises NSRange out of bound exception when calling alloc init. it seems that alloc init somehow calls initwithnib, which I don't have any. Is this control only supposed to be used with storyboard?
The text was updated successfully, but these errors were encountered: