Share My Creation [Class]: iMashPager Sliding Panels adopted from AHViewPager

Discussion in 'iOS Share Your Creations' started by Mashiane, Jul 18, 2016.

Similar threads

B4i Question b4a to b4i: AHViewPager
B4i Library [class] CustomListView
B4A Library [B4X] [class] MJPEG decoder
B4i Library [class] Table
B4i Library [class] SearchView
  1. Mashiane

    Mashiane Well-Known Member Licensed User

    Hi there

    This class is an adoption of the AHViewPager from B4A to enable one to add sliding panels to their iOS apps easily. Thanks to Klaus with help in one of the methods. The inspiration for this started when I was converting my b4a app to b4i and this was the major functionality I needed.

    In essence, this uses a scrollview with paging enabled with added methods to make it function like AHViewPager. There is no need of a "container" though here.

    There is a complete sliding page example here using a PageViewController but I did not want that.

    Usage:
    Copy the module to your shared code module. In the designer, insert this as a custom view.

    The zip file herein contains a working example.
     

    Attached Files:

    AndOrNot and Erel like this.
  2. Mashiane

    Mashiane Well-Known Member Licensed User

    Added a Refresh method to the class as sometimes it just did not display pages on first run.
     

    Attached Files:

  3. fbritop

    fbritop Active Member Licensed User

    I believe there is an error on your gotoPage sub. It should be like:

    Code:
    public Sub GotoPage(Index As Int, bSmooth As Boolean)
        CurrentPage = Index
        
    Log(sv.Panel.Width)
        sv.ScrollTo((Index) * (sv.Panel.Width/panels.Size), 
    0, bSmooth)
    End Sub
     
    cloner7801 and Mashiane like this.
  4. Mashiane

    Mashiane Well-Known Member Licensed User

    Thanks a lot for this. Will check it out.
     
    cloner7801 likes this.
  5. cloner7801

    cloner7801 Active Member Licensed User

    Hi, thanks for this class
    But GotoPage didn't work please help me I change the sub to #3 post but it again didn't work

    Update :

    I use the class in #2 post its GotoPage sub work but ! when I want to change the page it goes to other page(last page)

    I have 3 page and at first I go to page 1
    pager.GotoPage(1, True)

    But when I want to change the page(scroll) it goes to last page
     
    Last edited: Jan 28, 2017
  6. Leni Berry

    Leni Berry Member Licensed User

    Code:
    public Sub GotoPage(Index As Int, bSmooth As Boolean)
        CurrentPage = Index
        sv.ScrollTo((Index-
    1) * (sv.Panel.Width/panels.Size), 0, bSmooth)
    End Sub
     
  7. Mashiane

    Mashiane Well-Known Member Licensed User

    Let me perhaps upload an updated class, please check this version...
     

    Attached Files:

Loading...