This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
shinyformica last edited by
Hey all, I was seeing if I could wrap the UIStepper control to use it in my UI, and I got this far:
class Stepper(ui.View): def __init__(self, *args, **kws): import objc_util self._stepper = objc_util.ObjCClass("UIStepper").new() objcview = objc_util.ObjCInstance(self) objcview.addSubview_(self._stepper) self._stepper.flex = "WH" def layout(self): self._stepper.height = self.height self._stepper.width = self.width
And it does show a UIStepper widget in my view. But...that setting of the flex attribute appears to do nothing, and the layout() method which tries to force the stepper to be the size of the parent view doesn't do anything either.
I think this has to do with the fact that the actual objc view which the stepper is added to is not really manipulated by my view's layout() method or the flex attribute...but I'm not clear on how it works.
I'm also curious how best to create a pass-through for all the properties of the UIStepper I'd like to be able to get/set: just write a pass-through property on my ui.View which sets the underlying property, or is there some clever way to override setattr and getattr to automatically pass through to an objc view?
JonB last edited by
you need to set self.flex='wh'. then, when your view changes sizes, it calls layout.
mikael last edited by
Or, to look at it in another way, you are resizing the contained Stepper, but not the containing View.