iOS Question Button location is changing

Discussion in 'iOS Questions' started by Shay, Mar 3, 2015.

  1. Shay

    Shay Well-Known Member Licensed User

    I have this code
    if I move from this page and come back to it 2-3 times
    the button either disapear (going down - I can see part of it)
    or cover ~80% of screen, or all page is going up

    Code:
    Public Sub Initialize
        
    If Page1.IsInitialized = False Then
            Page1.Initialize(
    "Page1")
            Page1.RootPanel.Color = 
    Colors.RGB (54,54,54)
            Page1.HideBackButton = 
    True ' block button back
         
            
    If ButtonClose.IsInitialized = False Then
              ButtonClose.Initialize(
    "ButtonClose",ButtonClose.STYLE_SYSTEM)
            
    End If
            ButtonClose.Visible = 
    False
     
            
    If scvMain.IsInitialized = False Then
              scvMain.Initialize(
    "scvMain",100%x100%y)
            
    End If
            scvMain.Color = 
    Colors.Black
            scvMain.ScrollEnabled = 
    True
     
            Page1.RootPanel.AddView(scvMain, 
    0dip0dip100%x85%y)
            Page1.RootPanel.AddView(ButtonClose, 
    110dip87%y130dip50dip)
     
            ButtonClose.CustomLabel.Font  = 
    Font.CreateNew (20)
         
       
        
    End If
     
        Main.NavControl.ShowPage(Page1)
         
     
    End Sub
    edit: I think it is also the ScrollView is changing location and size (it has same color as my button)

    edit2: I removed the button and I still see this issue, so it is not related to the button, something is very wrong with the scrollview
     
    Last edited: Mar 3, 2015
  2. Erel

    Erel Administrator Staff Member Licensed User

    Why don't you add the views with the designer? Otherwise you must handle the Page_Resize event to reposition the views bases on the page size.
     
  3. Shay

    Shay Well-Known Member Licensed User

    Thanks, issue solved
    I moved it to designer and also had to add the following code:
    scvMain.ContentHeight = 100%y
    scvMain.ContentWidth = 100%x
     
    Erel likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice