我正在开发一个iOS应用程序,它有一个UIViewController,其视图有一个MapView作为子视图。但是,当我运行应用程序并尝试在模拟器中旋转视图时,它并没有按预期工作;它留下了一个黑盒子,如图所示:
如何告诉MapView调整其超级视图?
答案 0 :(得分:1)
尝试使用此代码
<强> ObjC 强>
unit MyPanel;
interface
uses
System.SysUtils, System.Classes, Vcl.Controls, Vcl.ExtCtrls;
type
TMyPanel = class(TPanel)
private
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('MyComponents', [TMyPanel]);
end;
constructor TMyPanel.Create(AOwner: TComponent);
begin
inherited;
end;
destructor TMyPanel.Destroy;
begin
inherited;
end;
end.
Swift
yourMapView.autoresizingMask = UIViewAutoresizingFlexibleRightMargin |
UIViewAutoresizingFlexibleLeftMargin |
UIViewAutoresizingFlexibleBottomMargin;