iOS Question background image over the whole screen

Wolli013

Well-Known Member
Licensed User
Longtime User
Is it possible to display a background image over the whole screen of B4I, even with a navigation bar?
If so, what do I have to do?

Greetings Wolfgang
 
display a background image over the whole screen of B4I, even with a navigation bar?
Your question is not clear.
1. Do you want to show an image over the navigation bar (means the navigation bar will be hidden under the image)?
2. Do you want to show an image under the navigation bar (means the navigation bar will be transparent)?

Which one you want?
 
Upvote 0
2. Do you want to show an image under the navigation bar (means the navigation bar will be transparent)?
 
Upvote 0
Add an imageview to the bottom of all view with anchors set to both in your bil file. Then use this code on page resize,

Code: Copy
Sub Page_Resize (Width As Float, Height As Float)
  
    Dim no As NativeObject = Main.NavControl
    Dim CGRect As Object = no.GetField("navigationBar").GetField("frame").RunMethod("CGRectValue", Null)
    Dim f() As Float = no.ArrayFromRect(CGRect)
  
    no.GetField("navigationBar").SetField("translucent", True)
    no.GetField("navigationBar").RunMethod("setBackgroundColor:", Array(no.ColorToUIColor(Colors.Transparent)))
    no.GetField("navigationBar").RunMethod("setBarTintColor:", Array(no.ColorToUIColor(Colors.Transparent)))
    no.GetField("navigationBar").RunMethod("setTintColor:", Array(no.ColorToUIColor(Colors.white))) 'nav bar text/icon tint color
    Page.RootPanel.Top = 0 - (f(3))
    Page.RootPanel.SizeToFit
    Page.RootPanel.Height = 100%y + (f(3))
  
End Sub
 
Upvote 0
I just can't get it right.
Maybe you'll point it out.
Enclosed my test code
Because of the file size I could not upload an image file with it.
 

Attachments

Upvote 0
Works well so far, only when you rotate the screen it doesn't work properly. Do you have a solution?
 
Upvote 0
If someone knows how to get it done, the following pages will be displayed all over the page. So without TabStrip?
 
Upvote 0
Try this:
Code: Copy
Sub Page1_Appear
   Dim no As NativeObject = NavControl
   Dim NaObj2 As NativeObject
   NaObj2 = NaObj2.Initialize("UIImage").RunMethod("new",Array())
   no.GetField("navigationBar").RunMethod("setBackgroundImage:forBarMetrics:",Array(NaObj2,0))
   no.GetField("navigationBar").RunMethod("setShadowImage:",Array(NaObj2))
   no.GetField("view").RunMethod("setBackgroundColor:",Array(no.ColorToUIColor(Colors.Transparent)))
   no.GetField("navigationBar").SetField("translucent", True)
   no.GetField("navigationBar").RunMethod("setBackgroundColor:", Array(no.ColorToUIColor(Colors.Transparent)))
   no.GetField("navigationBar").RunMethod("setBarTintColor:", Array(no.ColorToUIColor(Colors.Transparent)))
   no.GetField("navigationBar").RunMethod("setTintColor:", Array(no.ColorToUIColor(Colors.White))) 'nav bar text/icon tint color
End Sub

Private Sub Page1_Resize(Width As Float, Height As Float)
   Dim no As NativeObject = NavControl
   Dim CGRect As Object = no.GetField("navigationBar").GetField("frame").RunMethod("CGRectValue", Null)
   Dim f() As Float = no.ArrayFromRect(CGRect)
   no = Me
   Page1.RootPanel.Top = 0 - (f(3)) - no.RunMethod("statusBarHeight",Null).AsNumber
   Page1.RootPanel.Height = GetDeviceLayoutValues.Height
End Sub
 
Upvote 0
@Erel Thank you laüft super.
But how do I get it that the HG image is also displayed over the whole screen on subsequent pages?
 
Upvote 0
Back
Top