iOS Question Album from asset images and scrollview slideshow.

Discussion in 'iOS Questions' started by Mashiane, May 26, 2015.

  1. Mashiane

    Mashiane Expert Licensed User

    Hi there

    1. Is it possible to create a photo album from images stored in assets folder and
    2. Open the photo album as a gallery via code?
    3. How can I create a slideshow of my assets images perhaps with a scrollview?
     
  2. narek adonts

    narek adonts Well-Known Member Licensed User

    Didnt understood 1 and 2 questions.
    3rd question is easy with scrollview with pagingenabled=true and a timer to ScrollTo(nextimageview.left,0,true) for example
     
  3. Mashiane

    Mashiane Expert Licensed User

    In relation to 1 and 2 I meant the photo album. I have photos that are stored in the file.dirassets and want to copy these to an external folder e.g. file.dirdocuments/myalbum which will store images and open that as a photo album / gallery?
     
  4. narek adonts

    narek adonts Well-Known Member Licensed User

    you can create a folder with File.MakeDir and use File.Copy to copy your image files to that folder.
    To show it as an photo album you will need some Gride View. As as I know there is no open source gride view for b4i you can implement yours with a scrollview.
     
  5. Mashiane

    Mashiane Expert Licensed User

    Ok, this is what I have tried, everything seems to be working but when my page opens, only the last image is shown.

    1. I created a view with a panel and inside this panel a label and an image view, I call this layout slideImage. It's designer scripts are:

    Code:
    pnlMaster.SetLeftAndRight(0100%x)
    pnlMaster.SetTopAndBottom(
    0100%y)
    lblTitle.SetLeftAndRight(
    0100%x)
    lblTitle.SetTopAndBottom(
    010%y)
    imgPicture.SetLeftAndRight(
    0100%x)
    imgPicture.SetTopAndBottom(
    10%y100%y)
    Then I created another layout with a scrollview inside with pagination enabled, with its script being:

    Code:
    svSlideShow.SetLeftAndRight(0,100%x)
    svSlideShow.SetTopAndBottom(
    0100%y)
    Now, I read my images from a database like this...

    Code:
    Sub LoadSlideShow()
        b4iMash.ShowProgress(
    "Loading slideshow...")
        b4iMash.OpenDb
        
    ' clear all views in the panel
        svSlideShow.Panel.RemoveAllViews 
        
    Dim cur As ResultSet
        
    Dim sPath As String
        cur = b4iMash.Table_OpenRecordset(b4iMash.SQLite,
    "select * from [Pictures] order by [Key]")
        
    Do While cur.NextRow
            
    Dim sKey As String: sKey = cur.GetString("Key")
            
    Dim sText As String: sText = cur.GetString("Text")
            
    Dim sTag As String: sTag = cur.GetString("Tag")
            sPath = sTag.replace(
    "[","")
            sPath = sPath.replace(
    "]","")
            sPath = sPath.replace(
    ",","")
            sPath = sPath.replace(
    "-","")
            sPath = sPath.ToLowerCase & 
    ".jpg"
            
    ' load a new panel and inset image
            Dim pnlImage As Panel
            pnlImage.Initialize(
    "")
            pnlImage.LoadLayout(
    "slideImage")
            
    ' get the parent panel
            pnlMaster = pnlImage.GetView(0)
            
    ' get the label inside the panel
            lblTitle = pnlMaster.GetView(0)
            lblTitle.Text = sText
            imgPicture = pnlMaster.GetView(
    1)
            imgPicture.Bitmap = 
    LoadBitmap(File.DirAssets, sPath)
            svSlideShow.Panel.AddView(pnlImage,
    0,0,svSlideShow.Width,svSlideShow.Height)
            svSlideShow.ContentWidth = pnlImage.Width
            svSlideShow.ContentHeight = pnlImage.Height
        
    Loop
        cur.close
        b4iMash.HideProgress
    End Sub
    The page shows and shows the last image, how do I get the scrollview to show the first image i.e. first view added and then provide a way to slide through the images.
     
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