Closed jvonkluck closed 10 years ago
Oh so good software engineering practices are encouraged?
I'll revisit this as soon as I finish cleaning up my production app to play nice with iOS 7 and push a more thorough (tested / documented) commit.
I was getting ready to merge this, but I realized it uses sugarcube code! I like to keep these two projects separate. If I have time later I'll try and fix this, the relevant code is
def controller
if nextResponder && nextResponder.is_a?(UIViewController)
nextResponder
elsif nextResponder
nextResponder.controller
else
nil
end
end
# which i think could just be inline code =>
controller = view.nextResponder
until controller.is_a?(UIViewController) || controller.nil?
controller = view.nextResponder
end
Colin -
I'm just getting back to this now. Given that you prefer to keep the projects decoupled, do have a preferred approach other than simply duplicating the logic that walks up the nextResponder chain until it hits a controller?
yeah I think duplicating that logic would be appropriate here, it's not a lot of code, I think.
Please take a look and let me know if this is sufficient for a merge back into your upstream. I've added test coverage for the constraints and duplicated the small bit of logic from SugarCube to avoid a dependency.
Hi! I'm going to merge this, but in a slightly different way. I'm not a fan of having teacup simply redefine sugarcube's controller
method, instead I was thinking that code could be placed IN the body of the method, as a while
loop for example.
Oh my gosh, this totally fell off my radar. Sorry about that! Merged now, I removed the controller
method and am using in-line code like I mentioned above.
Thanks!
I'm not sure this covers every case or that it's the most generic way to add support for the topLayoutGuide, but it's working for me.