Forum Archive

Wrap an Objective C UIView in a ui.View

Webmaster4o

If I wanted to create new ui.View subclasses for Objective-C UIView classes, like many of the built-in classes do, what's involved?

JonB

Best bet is to create a ui.View, add the UIView as a subview. Set the autoresizingMask of the contained to represent flex(). Maybe wrap some attributes in @properties of your custom ui.View to do things to the contained UIview -- thinks like background color perhaps, but not attributes like frame, which you want controlled at the ui.View level.

Webmaster4o

Right. I noticed this is how @omz did it in that MapView from a while back. I guess there's a different way to do it but not from Python. Thanks.