How to delete a custom tableview cell? [duplicate] - iphone

This question already has an answer here:
Smooth reload of uitableview data when rows are deleted
(1 answer)
Closed 8 years ago.
i am using custom cell in uitableview cell.I am giving button on the right of the navigation bar .if user click on the button the delete cell option has to come like default cell delete option...can any one share code ...thanks in advance....

To delete a UITableViewCell, you should remove the data from the Array that populated the tableview. You can remove it using any logic, and the value of the row returned from the touch.
After that, a simple [tableView reloadData]; will do the trick.

Whenever you click the button corresponding the custom cell you should move the data of the next concurrent cells to their previous cell and then call [reloadData]

check this may help

Related

Buttons in table view cells cause unwanted scrolling

I have a button in my table view cell so that a user can like a post. Whenever I click the button, the table view scolls a couple cells up. I do not want this scrolling to occur. I also do not have paging enabled so I do not know why this is happening. Does anyone know how I can prevent this? Thanks.
Suppose you have liked on the 3rd row of the UITableView then simple call line like this
first update your array then call
self.tableView.reloadRowsAtIndexPaths([/*yourindexpath*/],
withRowAnimation: UITableViewRowAnimation.Fade)

Multiple columns within TableViewCell [duplicate]

This question already has answers here:
How to display multiple columns in a UITableView?
(6 answers)
Closed 10 years ago.
I'm creating an iOS app and will to create Table view cell with 3 columns inside of it. For example instagram profile page that contains the user information. Can this be achieved within xcode? I'm using a storyboard.
Yes it is very much possible in XCode. You'll have to create a custom UITableViewCell to create this. In your custom UITableViewCell you'll have to create different components as per your need.
I believe the yellow box in above pic is what you want to achieve. For this :
You'll have to create one custom cell with 3 UIImageView
EDIT :
In your UITableViewCell you'll have to create one UIImageView to show the profile picture.
Two UILabel one for the statistic. And, one for text.
One UIButton for Following.
How About the UICollectionView instead UITableView.
Create a custom cell.
You can either create the cell in interface builder or subclass UITableViewCell and overwrite its initWithStyle and layoutSubviews classes. You can access their properties within cellForRowAtIndexPath as usual. You could even do the layout in cellForRowAtIndexPath but I would not recommend that simply because of its bad style. For the user there would not be any difference.

tableview, adding a row, iphone app, objective c,

I have a tableview set up that i can drill down about 3 levels.
I have an edit button at the top that lets me delete rows.
I've just used a mutable array to store data and I can remove items from the array.
This all works fine.
For the life of me I can't figure out how to add a row.
I've been through all the documentation but can't get it working.
I've tried countless things.
I've edited numberOfRowsInSection so that in editing mode it is incremented by 1. But I don't know how to make that row appear.
I want an extra row at the bottom (in editing mode) so that I can add a row.
I just don't know how to get that row on the screen.
If someone has code for a simple tableview, just one view, that has an edit button that allows for adding and deleting a row I'd really appreciate it.
Just can't get my head around something here.
Cheers.
Stephen
You can add new item to array and call [UITableView reloadData].
Or you can use:
[tableView beginUpdate];
[tableView insertRowsAtIndexPaths:*arrayOfIndexPaths* withRowAnimation:*rowAnimation*];
[tableView endUpdate];

iPhone SDK, UIButton on UITableView, delete row if button was pressed [duplicate]

This question already has answers here:
Detecting which UIButton was pressed in a UITableView
(26 answers)
Closed 2 years ago.
I am new in iPhone development and now I have simple question(may be not simple:). I have a UITableView, and in that UITableView I have for example 5 rows, every row has a UILabel and UIButton.
What I want to do is to delete one element from the array when my button is pressed. Button I create with tag, but that doesn't work. I do not want use didSelectRow; I want to delete an element from the array only if my button was pressed. (For example, if the third button was pressed I want to delete the third element of the array. Using the standard delete button does not work for me.
If you have a custom UIViewController to manage each cell (which I highly recommend), simply wire up the button to an IBAction and have that method remove the item from whatever data structure supplies the UITableView with rows, and then tell the UITableView about it.
Failing that, I suppose you could attach a tag to each button, indicating which row it belongs to, and wire them all up to a single IBAction in your table-view controller.

expandable and collapsable uitableviewcell [duplicate]

This question already has an answer here:
Table view cell expandable iOS
(1 answer)
Closed 9 years ago.
I want to achieve something like an expandable and collapsible UITableViewCell. The part of collapsing and expanding on user tap has been achieved, but what i am looking for is the feature of showing more and less.
That is, when the UITableViewCell has not expanded to show full view, the word "more" should be displayed. When the UITableViewCell is expanded, it should show the word "less" at the end. So whenever the user taps on more, then only the UITableView should expand and vice versa. Any ideas on how I could do this? Something like on web pages. When u click on more link it expands the area and lets u see its entire content.
Expanding on iWasRobbed's answer, you are looking for WWDC 2010 Session 128, Mastering Table Views, which you can officially find at apple.com.
It includes a demo of expanding table cells by updating the values returned by tableView:heightForRowAtIndexPath: then calling:
[tableView beginUpdates];
[tableView endUpdates];
on the UITableView. Since you don't need to change which rows are shown, you don't need to include any code between begin and end. Once endUpdates is called, the heights of all the rows are re-calculated by calls to tableView:heightForRowAtIndexPath: for each row.
The video includes examples of how to animate the updates, including how to disable the animations.