I am developing a webview app, which just loads our website. I noticed that the content of the website is showing in the status bar if you scroll down the page. Is this default iOS browser behaviour or can I fix this?
            Asked
            
        
        
            Active
            
        
            Viewed 1,526 times
        
    0
            
            
        - 
                    Is this in debug mode? – Faysal Ahmed Jul 09 '19 at 09:16
 - 
                    How do I know if it is? – Black Jul 09 '19 at 10:24
 - 
                    You just build the app on a device right? – Faysal Ahmed Jul 09 '19 at 10:39
 - 
                    @FaysalAhmed, yes, I have an iPhone were I test the app – Black Jul 09 '19 at 10:43
 - 
                    1For next time, take an actual screenshot (not a photo of your screen). To do so on the simulator, press ⌘S; on an iPhone, press the lock button and volume up or down button simultaneously. – fphilipe Jul 10 '19 at 06:12
 
3 Answers
4
            You need to add your top constraint (a controller with web site) to the safe area. I hope it will fix your problem

EDITED
Here is detailed screenshot how it's can be done: (also, about constraints, check this documentation)
        Mike H
        
- 487
 - 2
 - 13
 
- 
                    Where do I find this? Can you add more screenshots please, it would be really helpful. – Black Jul 09 '19 at 10:26
 - 
                    1
 - 
                    In your screenshot there is View which has the children View and Safe Area. But I only have View which has the child "Safe Area". How can I add the other View? – Black Jul 09 '19 at 10:43
 - 
                    There should be something like WebView (since you are displaying web content). Maybe web view is added in the code – Mike H Jul 09 '19 at 10:45
 - 
                    If I click on safe area and try to add a constraint then everything is grayed out and I can't interact with the settings. – Black Jul 09 '19 at 10:52
 - 
                    I restarted my project by following the following tutorial, now your answer works. https://www.youtube.com/watch?v=xQmZSKxOYvs – Black Jul 18 '19 at 13:05
 
1
            
            
        For iOS 11 and upper OS create this issue during debug time. This will fix for the released version. I have faced this problem many times during work.
Don't know how but it happens.
So you can try to create a release version and check on your device.
        Faysal Ahmed
        
- 7,501
 - 5
 - 28
 - 50
 
- 
                    
 - 
                    
 - 
                    
 - 
                    You need to know first how to export release version of ipa. Then install the ipa on your device and check. – Faysal Ahmed Jul 09 '19 at 12:43
 - 
                    1This will help you to know: https://stackoverflow.com/questions/5499125/how-to-create-ipa-file-using-xcode/47940681 – Faysal Ahmed Jul 09 '19 at 12:44
 - 
                    
 - 
                    1. Open Xcode 2. Go Window > Devices and Simulators. 3 You can see your device is present 4. You can see installed Apps section and a plus icon in the bottom. Simply click the icon and select your iPA location and apply. – Faysal Ahmed Jul 10 '19 at 12:10
 - 
                    Ok, I managed to do it, I installed the IPA but the same error persist... so it is not the solution – Black Jul 10 '19 at 12:36
 - 
                    
 - 
                    
 - 
                    1I have created the IPA using distribution certificate and looks the issue is fixed. It's my personal experience. – Faysal Ahmed Jul 10 '19 at 12:53
 - 
                    
 
0
            
            
        The programmatically approach would be:
view.addSubview(webView)
let guide = view.safeAreaLayoutGuide
webView.topAnchor.constraint(equalTo: guide.topAnchor).isActive = true
webView.leftAnchor.constraint(equalTo: self.view.leftAnchor).isActive = true
webView.rightAnchor.constraint(equalTo: self.view.rightAnchor).isActive = true
webView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor).isActive = true
    
        FrugalResolution
        
- 568
 - 4
 - 18
 

