Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.

Welcome, Guest
Guest Settings

Thread: Problems With Images

Permlink Replies: 0
Stephen Corbett

Posts: 17
Registered: 2/10/11
Problems With Images
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 5, 2014 10:45 PM
Shared experience, hope this helps someone!

I've been working on an XE6 application where I want to display an album of images and then display a selected image in a full screen view, with the capability of swiping left or right to see the next/previous image. Should be easy, right? I settled on using the TImageViewer component which appeared to work fine. Set the scaling property to size the image appropriately for the screen size and rotation. Everything works hunky-dory on Windows and Android. However, on iOS (real and simulator) swiping over the TImageViewer causes the image to move around and prevents the desired left or right swipe from passing to my code.

Well I've spent over two frustrating days attempting to resolve this. I've tried subclassing the TImageViewer and blocking the igiPan gesture that appears to be triggered. I tried using TImage and TImageControl components but run into many brick walls, especially with scaling of the controls and the underlying bitmaps. I even tried the DPF Native iOS image component.

I found this article that helped me find my solution. I place a TRectangle on the form and set it's align property to centered, it's "stroke kind" to TBrushKind.bkNone, its "fill kind" to TBrushKind.bkBitmap and the "bitmap wrap mode" to WrapMode.wmTileStretch. Then before assigning the bitmap I resize the rectangle so that it has the same height and width ratio as the image and the maximum size that will fit in the client area. All is good, the images are sized correctly on all platforms, swiping works and the TRectangle is apparently much lighter on resources than TImage.

Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02