Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working on a UITableViewController #19

Open
ed-mejia opened this issue Feb 11, 2016 · 11 comments
Open

Not working on a UITableViewController #19

ed-mejia opened this issue Feb 11, 2016 · 11 comments

Comments

@ed-mejia
Copy link

Hi, this is a great lib, I used it over a UIViewController and works wonderfull

But then I tried to use it on a UITableViewController and it does not work at all 馃槗

@wlzch
Copy link

wlzch commented Feb 16, 2016

Is there any plan to support UITableViewController?

@aschuch
Copy link
Owner

aschuch commented Mar 8, 2016

Hi, yes I've see this as well. For some reason, UITableViewController does some internal layouting that prevents any added subviews to correctly show and hide.
I do intend to support UITableViewController at some point, but I'll need to investigate a bit more. If anyone has a workaround or more info on UITableViewController internals, I am all ears. 馃挴

@AnthonyMDev
Copy link

Have you tried setting the layer.zPosition of the subview to a number higher than that of the UITableView on the controller? Or possibly just using `bringSubviewToFront(view:)

@AnthonyMDev
Copy link

Well, setting the layer.zPosition was a part of the solution, but it wasn't nearly as simple as that! I've made a PR that solves this. @aschuch, let me know what you think of it!

@AnthonyMDev
Copy link

AnthonyMDev commented Jun 28, 2016

@aschuch Hey there! Just wanted to confirm that this library is still actively maintained, since we haven't heard any reply about the fix I've proposed. It's totally fine if you're busy right now and just need some time to get to it, but I'm just confirming, because if this isn't being maintained, I'm gonna push a new Pod from my fork. Thanks! :)

@aschuch
Copy link
Owner

aschuch commented Jul 1, 2016

Hi, yes this framework is still actively maintained. I am quite busy right now, so I am not as responsive as I should be atm. I'll definitely try to get a look at this soon. 鉁岋笍

@bbqsrc
Copy link

bbqsrc commented Sep 9, 2016

Any progress?

@croossin
Copy link

^

@pangpingfei
Copy link

i tried many times...but not my mistake...

@bjrne
Copy link

bjrne commented Mar 13, 2017

@aschuch Any progress so far?

@ed-mejia
Copy link
Author

Hi @bjrne I came up with some hack to make it work.

In your UITableViewController

Create a container view:

var sfViewContainer: UIView!

And then in your viewDidLoad:

// for UITableViewControllers we need to setup a special container, 
// we can't use ViewStateMachine     the same way like in UIViewControllers
        sfViewContainer = UIView(frame: tableView.bounds)
        sfViewContainer.backgroundColor = .clear
        sfViewContainer.autoresizingMask = [.flexibleWidth, .flexibleHeight]
        tableView.addSubview(sfViewContainer)
        tableView.bringSubview(toFront: sfViewContainer)
// stateMachine is your ViewStateMachine
        stateMachine = ViewStateMachine(view: sfViewContainer)

after this initial setup you should be able to use StatefulViewController as usual.

@bjrne
Copy link

bjrne commented Mar 14, 2017

@ed-mejia Thanks a lot! I'll try this.

@aschuch
Copy link
Owner

aschuch commented May 16, 2017

I've pushed some changes to master that allow for better support of UITableViewController and UICollectionViewController (thanks @AnthonyMDev).
Please take a look and report any issues. Thanks! 鉁岋笍

@JustinDSN
Copy link

JustinDSN commented Nov 22, 2017

@aschuch, The master version of this library seems to get UITableViewController working quite nicely. The workaround you proposed doesn't work because the stateMachine property is read-only.

We'd prefer to use an 'actual release' so could you please publish a new release so we could take our dependency on it?

In addition, I also wanted to get your thoughts on using this library, as opposed to other options as proposed by these blog posts / github + videos:

As a Swift developer, I greatly appreciate you creating this library and I've used it in a few apps. Would like to know if you have a new preference moving forward and we can point our Swift / App developer community towards that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants