Coder Social home page Coder Social logo

Comments (9)

mbigatti avatar mbigatti commented on May 30, 2024

Hi. I believe that moving the contentView inside the UIScrollView is not possible as contentView is a readonly property and if I detach contentView from its superview I'll not be able to replace it with the UIScrollView. I think the other your suggestion is explorable: to copy also the layout constraints. I will look into it. Thanks for the report

from bmxswipablecell.

cameroncooke avatar cameroncooke commented on May 30, 2024

I've actually managed to implement the later suggestion of reinstalling the constraints against the new contentView. What's the best way for me to contribute the code back?

from bmxswipablecell.

mbigatti avatar mbigatti commented on May 30, 2024

glad to hear that. The best way to contribute back on a github project in general is to fork the original project, modify the code, commit and create a pull request. Then the repo owner will be able to merge into his project, most of the time automatically. If you feel uncomfortable with that you can create a gist with the modified code snippets and I will import that into my version

from bmxswipablecell.

cameroncooke avatar cameroncooke commented on May 30, 2024

That's cool, I'll do that.

from bmxswipablecell.

mbigatti avatar mbigatti commented on May 30, 2024

Thanks for the contribution. I'll merge it ASAP

from bmxswipablecell.

cameroncooke avatar cameroncooke commented on May 30, 2024

I've not tested it a huge amount but it seems to work with the existing
demo project and works with my auto-layout cells that I'm using it for on
another project. I did move the code that moved the subviews from the
orignal contentView out of the layoutSubviews as I was worried about
performance has this method gets hit lots of times and it seems to make
sense for it to do it at the end of the init code. That said it expects
storyboards to have already populated the contentView by that point so it
might not work if not using IB so it might need some tweaking.

Cameron Cooke
Senior Mobile Developer

Tel: 01273 625959
Web: www.brightec.co.uk
Twitter: www.twitter.com/brightec

On 31 October 2013 16:04, mbigatti [email protected] wrote:

Thanks for the contribution. I'll merge it ASAP


Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-27499026
.

from bmxswipablecell.

mbigatti avatar mbigatti commented on May 30, 2024

I'll do some more testing. BTW, the call was in layoutSubviews for a mean, that I do not recall currently. It has to do to different timing of various iOS mechanisms. I'll double check that. Thanks

from bmxswipablecell.

cameroncooke avatar cameroncooke commented on May 30, 2024

Yeah I was trying to find somewhere else to put that logic as
layoutSubviews can get called all the time especially when layout changes.
I guess you don't really want to put code that add/removes subviews in
layoutSubviews as this method is used for laying out existing subviews.
Though I get why it's there as it's hard work trying to detect when the
view hierarchy changes. I did try using KVO to detect CRUD operation on the
contentView but it seems UIView does not support KVC.

In my fork I've added the moving logic to the end of the bmx_init method
which works great for storyboard and nib files as they are guaranteed to be
loaded, but I guess it won't guarantee that custom UITableView cells where
the views have been added programmatically will have finished adding their
views by the time that init call happens.

Cameron Cooke
Senior Mobile Developer

Tel: 01273 625959
Web: www.brightec.co.uk
Twitter: www.twitter.com/brightec

On 31 October 2013 16:15, mbigatti [email protected] wrote:

I'll do some more testing. BTW, the call was in layoutSubviews for a mean,
that I do not recall currently. It has to do to different timing of various
iOS mechanisms. I'll double check that. Thanks


Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-27500180
.

from bmxswipablecell.

mbigatti avatar mbigatti commented on May 30, 2024

Hi. Just a quick note to let you know that I reintroduced the call to bmx_moveContentViewSubViews into layoutSubviews, because in the case of a cell that has no label text defined in the NIB/Storyboard, the related UILabel is created only when text field is populated, and it is added to contentView rather than (obviusly) in the scrollViewContentView. I still have a call bmx_moveContentViewSubViews in the init phase as this method is designed to work incrementally so you can do some work on init and (eventually) some additional work afterwards. Unfortunately, contentView is a readonly property so I can not provide my own subclass to intercept subviews adding.
This is not tested with Auto Layout, I'll do that when I have the time. Thanks

from bmxswipablecell.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.