2

Okay What i want to do is position a custom cell so that the cell looks like only a portion of it is shown in the UITableView. When you swipe it to the left it goes to a new viewcontroller that allows the user to add details for a new cell. My question is how do we position the UITableViewCell to show only a portion of it in the tableView?

What i want to do is position a custom cell so that the row is not shown fully like about 1/4th or 1/2 its actual length only in the table view

here is an app with the functionality i'm trying to implement this is the image url as i can't post images yet

Here is the image http://a3.mzstatic.com/us/r30/Purple6/v4/01/16/ec/0116ec99-0206-d125-7d27-d5956b918635/screen568x568.jpeg

I want to implement my cells just like how they implemented their expenses in cells, the cell is positioned according to the amount in it ,if the amount is high the cell is placed further to the left else only 1/4th of the cell is shown(empty cell no expense )

Can we achieve this by making an imageview in a customcell and then changing the x-axis of the image view according to the amount entered in the cell? Thanks in advance

Maverick
  • 319
  • 2
  • 13
Jerrin
  • 173
  • 1
  • 14
  • 2
    Can you attach some screens and code? – Jakub Feb 28 '14 at 12:24
  • [tutorial](http://www.appcoda.com/customize-table-view-cells-for-uitableview/) for you – Omer Obaid Feb 28 '14 at 12:25
  • Check If you have set the same height in custom cell & in tableview size as well. – zaheer Feb 28 '14 at 12:27
  • @OmerObaid I know to create custom cells what i want to know is how to change the position, and i can't add screens i need atleast 50 rep for that – Jerrin Feb 28 '14 at 12:33
  • 1
    position a cell like that is not good idea, but u can have view inside the cell then postion that view is quite simple – CoolMonster Feb 28 '14 at 12:59
  • @CoolMonster Do you mean change the content view of the cell along the x axis? – Jerrin Feb 28 '14 at 13:04
  • no, dont touch that, it may affect default behaviour of cell, You can add view as direct child of cell then add all other component into that view, so u can simple change the x and width of this view to attain your design – CoolMonster Feb 28 '14 at 13:06

2 Answers2

0

For this, I would do it this way :

For each of my model cell I add a state, in the delegate of UItableView i use heightForRowAtIndex to set the size depends of the cell's state. To not show extra view (when the cell is cliped) use :

[myCellview setClipToBounds:YES];

I think it should do the tricks. Even if it's not the best way to do it!

Fogia
  • 127
  • 1
  • 8
0

Solved it i Just had to add a scroll view to the cell's content view and then add a view containing the color to the scroll view. So its coding is similar to the swipe deletion in 'UITablView'

https://github.com/TeehanLax/UITableViewCell-Swipe-for-Options

this repository helped me out, i only had to make a few changes otherwise that was it thanks for all your suggestions :)

Jerrin
  • 173
  • 1
  • 14