Adds auto_set_content_size for UIScrollview and subclasses. #196
Conversation
So that you can add a bunch of things toa scrollview and then call auto_set_content_size and it will not change frame but automatically set the contentSize based on the scroll view's contents (with optional padding)
Once #195 is merged, I'll modify this PR to pull out the subview size calculation into its own method so that it's not repeated in both |
* master: Allows you to specify right and bottom padding for resize_to_fit_subviews Conflicts: spec/position.rb
This is awesome. I'd like to bring up a major issue that is starting to rear it's head. @twerth your feedback on this idea would be most appreciated. this is Since Mark's code here is not actually resizing a scrollview, should we possibly add aliases to the others, taking the It would be nice to add some conformity in thisWe remember one method that changes depending on the object. I'm going to suggest |
I agree to having some conformity in these names. IMO, auto_set_content_size means it will automatically set content size when something happens. That's the way I read it. I'd rather that be named something that suggests it's going to happen right now and only right now. |
I see your point. I picked "auto_set" because it automatically sets it based on the subviews. I'm open to a different name though |
I'd actually like to eventually have an "auto_set" where it does automaticallyl set it when something changes. But that's a bigger feature. Imagine you do this |
It's long, but how about: I'm a big believer in "make a method name as short as possible and be completely clear, and no shorter" |
Also, I'm Playing with |
I personally don't like |
I'm not a fan of the shorter name. not descriptive enough. It's a complex task we're trying to describe in just a few words. if we're gonna go with |
/giphy Take my ball and go home. |
Yeah, that makes sense @markrickert. I like that. Leave the alias for now though for backwards compatibility. |
…tent_size * 'master' of github.com:infinitered/rmq: Allow setting keyboard_appearance with a symbol use Numeric#close? to get rect specs to pass on device make rmq.device.simulator? spec work when run on the device
To fit conventions agreed upon.
Cool. I've renamed the method as well as changing the frame setter and creating an alias to the old method. |
Tests passed :) |
Allows you to pass :only_width and :only_height so that things aren't resized that you don't want to be :)
New feature for Allows you to pass Useful for when you have views inside a uiview that don't extend all the way to the right and you only want to resize the height of the frame. |
Adds auto_set_content_size for UIScrollview and subclasses.
lol |
Hey @markrickert I just searched for this today on the docs. Let me know if you want any help adding them! I need to go through anyway and add docs for my stuff. |
So that you can add a bunch of things to a scrollview and then call auto_set_content_size and it will not change frame but automatically set the
contentSize
based on the scroll view's contents (with optional padding)