-
Notifications
You must be signed in to change notification settings - Fork 228
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
Frame of handles are not set on parent view viewWillAppear: #34
Comments
Hi, The reason the lowerValue is not correct is actually todo with some range checking when setting the value. Try setting the upprtValue first then the lowerValue. Everything should work. Although I am not totally sure how this is related to the subject of frame handles not set on superview? |
lowerValue is correct, but if you will try to update frame of self.lowerLabel before parent view viewDidAppear, you will get that lowerCenter is {0;0}. I just want set up frames before my view appears on screen, but it impossible, cause you set frames of handles only in layoutSubview: |
OK, I understand now. Not really sure what would be the correct way to this. Maybe the subviews can be setup in configureView, this seems to fix that particular bug. |
Otherwise, maybe lowerCenter/upperCenter should not be calculated from the handles subview, the current code actually uses _lowerHandle.center, this would be incorrect if the image used alignment insets.... |
May be you need make slider class more generic and add labels in it? I had no time to look more close on it, but if you want, later I can make PR. |
Yeah not really interested in adding labels to the control, its a very specific use case and could be require in a million different ways. For now, just call [self.labelSlider layoutSubviews] at the start of the configureLabelSlider and it should work around your issue. |
I have the same issue. @muZZkat you cannot call |
@pronebird, I reworked the code a little so some of the initial frames get calculated in the init method. Haven't had time to push the final fix, I will try and get onto it tonight. |
@muZZkat thanks a lot. I think I will calculate centers manually for the time being, as it does not seem to be a big deal, although I admit, it can get handy. Thanks for such an awesome control! |
Hi @muZZkat, any headway on this issue? I am trying to load labels based on the location of the handles, and the handle center CGPoints are inaccurate until they are adjusted. |
any news on this issue ? |
Try this in demo without any changes in other places:
You will see that lowerLabel stiil 0, etc... and you cannot update it till viewDidLoad, cause frames are set only in layout step.
The text was updated successfully, but these errors were encountered: