菜鸟教程小白 发表于 2022-12-12 22:26:10

ios - 谷歌 Logo 隐藏在底部任务栏后面


                                            <p><p>在我的应用程序中,我使用的是 Google Maps SDK。<br/>
我的应用程序中有一个全屏 map 。<br/>
问题是 GoogleLogo 在导航选项卡后面的屏幕底部被截断。
我不知道要改变什么来调整 map 大小以在屏幕上显示 Logo 。
我会附上问题的截图,但我没有足够的声誉。 </p>

<p>由于我是 Obj-C 和 Xcode 编程的新手,我可能忘记发布 map 实现所必需的部分代码。</p>

<pre><code>- (void)viewDidLoad
{
    ;
    _firstLocationUpdate = NO;
    _errorView.layer.cornerRadius = 5;
    _errorView.clipsToBounds = YES;

    GMSCameraPosition *camera = ;

    _mapView = ;
    _mapView.delegate = self;

    ;
    ;      
}
</code></pre>

<p>我设法把它强了一点,但这真的很丑陋。</p>

<pre><code>    _mapView = [GMSMapView
               mapWithFrame: CGRectMake(
                                        0, -50,
                                        self.view.frame.size.width, self.view.frame.size.height)
               camera: camera];


;
;
</code></pre></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>另一种选择是在保持 View 大小相同的同时填充控件:</p>

<pre><code>// top, left, bottom, right
_mapView.padding = UIEdgeInsetsMake(0.0, 0.0, 50.0, 0.0);
</code></pre>

<p>使用 SDK 1.8 进行测试,它会移动 GoogleLogo 和各种控件。</p>

<p> <a href="https://developers.google.com/maps/documentation/ios/reference/interface_g_m_s_map_view#a66668a48bbc864faee1e8ba71e4c9bec" rel="noreferrer noopener nofollow">Google SDK documentation for the <code>padding</code> property</a> :</p>

<blockquote>
<p>Controls the &#39;visible&#39; region of the view.
By applying padding an area arround the edge of the view can be created which will contain map data but will not contain UI controls.</p>

<p>If the padding is not balanced, the visual center of the view will move as appropriate. Padding will also affect the projection property so the visible region will not include the padding area. GMSCameraUpdate fitToBounds will ensure that both this padding and any padding requested will be taken into account.</p>

<p>This property may be animated within a UIView-based animation block.</p>
</blockquote></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 谷歌 Logo 隐藏在底部任务栏后面,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/23905246/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/23905246/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 谷歌 Logo 隐藏在底部任务栏后面