iOS Question cannot access top part of page

ilan

Expert
Licensed User
Longtime User
hi

i show a second page with modal presentation. as you can see in the picture the top part is blank and the value y0 does not start from the top. it starts about 20-30 pixel below. now i guess its the place for the toolbar but i dont show any tool bar in my navigationcontroller. is it possible to show on 1 page a toolbar and on another no toolbar?

i would like to fill that place with something like a label with a title but i cannot do it. so i thought i could show the toolbar but i only want to do that when the second page is showing. do i have to use another navigation controller and add that page to that navigation controller?

this is the code to show the second page:

B4X:
Public Sub PresentPage2(Parent As Page, dialog As Page)
    Dim no As NativeObject = dialog
    no.SetField("modalTransitionStyle",0)
    Dim no2 As NativeObject = Parent
    no2.RunMethod("presentViewController:animated:completion:", Array(dialog, True, Null))  
End Sub

this is my code in the main page:

B4X:
    NavControl = Nav
    Page1.Initialize("Page1")
    Page1.RootPanel.Color = Colors.White
    NavControl.ToolBarVisible = False
    NavControl.NavigationBarVisible = False
    NavControl.ShowPage(Page1)

this is what i found: https://stackoverflow.com/questions/9724194/presentviewcontroller-and-displaying-navigation-bar

p1.png
 

ilan

Expert
Licensed User
Longtime User
This is not the correct way to implement a dialog in B4i. Why aren't you using B4XDialog or a similar solution that uses a regular panel.

if you can remember some time ago i asked for an option to decrease the lines in the process global section and you wrote that if i have so many objects and views i probably am doing something wrong and i should separate them in different classes and pages. so thats what i did. instead of adding all panels and views in a single layout or class i am using now multiple pages and classes.

its simpler like this to find bugs and understand the code.
a lot of apps use that kind of modal presentation and i also want to do it in my apps. the problem is only that the top part of the page is blank and that i cannot put any view in that place in my layout.

EDIT: https://www.b4x.com/android/forum/threads/process_globals-shrink-function.111716/#post-696810
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
if you can remember some time ago i asked for an option to decrease the lines in the process global section and you wrote that if i have so many objects and views i probably am doing something wrong and i should separate them in different classes and pages. so thats what i did. instead of adding all panels and views in a single layout or class i am using now multiple pages and classes.

its simpler like this to find bugs and understand the code.
Correctly using classes has nothing to do with this. I haven't recommended you to use multiple pages only to use multiple classes.
You can implement the dialog in its own class.
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
i still like the way of the modalTransitionStyle. it is used a lot now in a lot of apps and you can also dismiss it by swiping down. it runs very smooth so i would like to use it.
do you have a solution for the missing part at the top?

thanx, ilan
 
Upvote 0

ilan

Expert
Licensed User
Longtime User

thank you for your help erel, i tried several options but unfortunately nothing solved the issue.
if you have time you can have a look at the example i attached.

the result should be like this:

1.png

as you can see the top has a view in it. i am not sure if it is a panel with views inside or a toolbar. but in b4i what i get is an empty space even if i use NavControl.NavigationBarVisible = True.

thanks a lot, ilan
 

Attachments

  • b4iTest.zip
    1.2 KB · Views: 241
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
There are several mistakes in your code. If you insist on not using the designer then you need to take care of resizing the layouts yourself.

1. Don't assume that the page will only be resized once. It can be resized many times.
2. Don't assume that the size of page2 is the same as page1.

Watch the B4J / B4i resize event video tutorial for more information: https://www.b4x.com/etp.html

The gap that you see is related to the way the page relates to the status bar. The simplest solution is to make the page color transparent and add a new panel (pnlRoot) that with a solid color. See the attached example.
 

Attachments

  • b4iTest.zip
    3.5 KB · Views: 218
Upvote 0
Top