[英]How can I tell a subview to resize when its superview changes size?
I'm working on an iOS application that has a UIViewController whose view has a MapView as a subview. 我正在使用具有UIViewController的iOS应用程序,该UIViewController的视图具有MapView作为子视图。 However, when I run the application and try to rotate the view in the simulator, it doesn't work as it should;
但是,当我运行该应用程序并尝试在模拟器中旋转视图时,它无法正常工作; it leaves a black box as shown:
它留下一个黑框,如下所示:
How can I tell the MapView to resize along with its superview? 如何告诉MapView调整其超级视图的大小?
Try to use this code 尝试使用此代码
ObjC 对象
yourMapView.autoresizingMask = UIViewAutoresizingFlexibleRightMargin |
UIViewAutoresizingFlexibleLeftMargin |
UIViewAutoresizingFlexibleBottomMargin;
Swift 迅速
yourMapView.autoresizingMask = [.FlexibleRightMargin, .FlexibleLeftMargin, .FlexibleBottomMargin]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.