0

How to display multiple images in a single cell on clicking forward and back button like shown in below image.

enter image description here

Sivajee Battina
  • 4,124
  • 2
  • 22
  • 45
tnishanth
  • 11
  • 3
  • Replace the image on button click? You just need a custom tablecellview and some basic objective c knowledge – Pat_Morita May 02 '17 at 18:10
  • Use custom tableview cell. – pkc456 May 02 '17 at 18:11
  • @Pat_Morita How to get popup on clicking that image – tnishanth May 02 '17 at 18:17
  • 1
    add scrollview with paging in your customcell. please refer http://stackoverflow.com/questions/7645779/can-we-add-a-scroll-view-inside-uitableviewcell http://stackoverflow.com/questions/19185446/horizontal-uiscrollview-inside-custom-uitableviewcell-using-ib-storyboard-no http://stackoverflow.com/questions/18273250/add-uiscrollview-with-paging-to-existing-uiviewcontroller http://stackoverflow.com/questions/12740425/ios-how-to-do-proper-paging-in-uiscrollview – Gagan_iOS May 02 '17 at 18:17
  • To open a popover either work with storyboard and a popover segue or instantinate your own popoverViewController – Pat_Morita May 02 '17 at 18:20
  • Customize the table view cell and use any third party libraries https://cocoapods.org/?q=gallery for easy handling of gallery – Sivajee Battina May 02 '17 at 18:22

1 Answers1

2

I guess your table array will look like:

[
    {
        price   : "$ 000",
        adress  : "adress",
        size    : "size",
        imagesArray : [
                    {
                        imageName : "name",
                        image  : "image"
                    }
                  ]
    }
]

Use collection view in table view cell, and enable pagination for collection view. Pass images array to collection view

or

if use image view only in table view cell, you should maintain position of the images. So just create a mutable position array with table array count like table array as 3 values, and the position array should be like [0,0,0]. Initially, 0th index will be visible. so given values are 0.

in cellForIndex method:

NSArray * imageArray =[NSArray new];
imageArray = [[tableArray objectAtIndex:indexPath.row] valueForKey:@"imagesArray"]

NSInteger imageIndex = [positionArray objectAtIndex: indexPath.row];

cell.imageView.image = [imageArray objectAtindex:imageIndex] valueForKey:@"image"]

Set indexpath as a tag for arrow buttons.

if you click right arrow in 1st index of table view, In target method, get index from tag and increase value at 1st index value of position array. Now reload table view or particular cell.

W2S Solutions
  • 141
  • 1
  • 3