iOS Question Centre a view in the 'Left' parameter of .AddView

Sanxion

Active Member
Licensed User
Longtime User
Hi all

I am attempting to centre a view in the left parameter of .AddView:

B4X:
Page1.RootPanel.AddView(adTopBanner,(Page1.RootPanel.Width - 320dip) /2 ,0%y,320dip, 50dip)

However, the ad is not appearing in the centre but at the left most position?

Thanks
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
It's recommend to add the view in the Page_Resize sub.
I don't completely agree. It is best to add the views with the designer. If that is not possible then add them when the page is created and call SetLayout in the Page_Resize event.

Page_Resize can be called multiple times.
 
Upvote 0
Top