How to customize button in UITableViewCell? - iphone

I have implementing listing page in UITableView.Now i am flicking finger on to the table cell then delete button appear but i want to my custom image insted of delete.Is it possible please give me advise?

You can try to create your own button and add it to your cell as a subView.

There isn't a built in way to change that button, it's part of the standard UI. You could, however, catch the flick yourself, and create your own button that says whatever you want.
I think it might be possible to grab the deleteButton reference and alter it, but that would affect the whole application and isn't a good practice to get into.

Related

IPhone need design idea for tableview

i have a UITableView where i want one cell(database row) needs to be default,
So I am thinking of two options
in TableView upon clicking a cell, change accessoryType to mark just like ringtone selection in settings app
when user enters data, add an option (like radio button or segmented control) to make that cell (database row) as default one
I feel first option is good but we can implement code for that only in didSelectRowAtIndexPath but i need to jump to another view when user click on a cell.
So please give me an idea how to accomplish this
One idea iam thinking is adding an edit button but don't know whether its possible or not.
Thanks
Not sure if i understand your question correctly , but according to what i understand you want a table view in which many values will be there , and you want one value to be default which can be changed later.
According to me these ways would be pretty good,
Changing the accessorytype of the tableViewCell. (Most common way)
Changing the Highlighted property of the cell on loading the tableView.
Adding some image then setting the image as the background view of the selected cell.
Adding custom image view (such as tick or something and adding to the cell).
this code can be put in the viewDidload so your default selected value appears.
Hope this helps.
Don't know what you mean by default. I'm assuming you mean already selected. You might just want to set the accessoryType to the checkbox. That would be Apple's way of doing it.

create custom delete button for uitableview

Im working on an ios app and my question is how to change the default button on swipe to delete on a uitableview. i see i can change the text with titleForDeleteConfirmationButtonForRowAtIndexPath but i want to change the image completely. ive been looking around for a way and all the posts about it may be out of date so just want to confirm with people before i go ahead with this. What im going to do is add a gesture recogniser to the cells themselves to catch the users swipe on individual cells and then add in my custom button and re arrange the cell frame from there and just forget about apples default swipe to delete completely. how that sound?
Here is a great open-source class for doing exactly this, based on the behavior of the Twitter app:
https://github.com/thermogl/TISwipeableTableView

Delete cells in table view Iphone with edit button

I have a table view with different cells and basically I would like an edit button which would then make those red circle appear in each cell and be able to delete them. I already know how to make the "Edit" button appear and also I have overridden the commitEditingStyle method for the table view so I would like to know how to link the button to the action which trigers the red circle and how to make them appear and finally how to actually delete the cells thankyou :)
The editing style on your table view cells should be set to UITableViewCellEditingStyleDelete, and then you just need to make sure to call setEditing:animated: on your table view. UITableViewController can help provide a lot of this functionality pre-baked.
That's actually done through an undocumented API (though I'm not quite sure why) - using it would probably get your app rejected.
However, lots of apps simulate this functionality with their own code - you'd basically define a custom UITableViewCell subclass which changed its background color / toggled that extra red circle image when tapped, keep track of which cells had been tapped, and finally delete them all by calling deleteRowsAtIndexPaths: on the table with the collected list of rows.

How to mark multiple UITableViewCells and perform an action on marked cells?

I would like to do pretty much what the Mail Application does: that when I select Edit, instead of the usual Delete Button, Radio Buttons appear on the side that may be checked by the user, then the user may click on a Button to take an action on the marked cells(any kind of action not just delete). Is there any apple sample code that does this?, can anyone please provide some code or documentation on how to do this?. Thank you.
-Oscar
I haven't done this so all of the following comes straight from the documentation. This is how I would do it:
Overwrite your view controller's setEditing:animated: method to display one or more buttons to execute your batch action (just like Mail.app does) when the table goes into editing mode.
Use a custom UITableViewCell subclass for your cells.
The key is to overwrite willTransitionToState: in your custom cell class. In this method, add a custom subview containing your radio button to the cell.
Overwrite layoutSubviews to position the radio button and the rest of the cell's content in the cell.
In tableView:didSelectRowAtIndexPath:, differentiate between the normal and editing states. If the table is in editing mode and the user taps a cell, mark it as selected (modify your radio button subview accordingly) and keep a record of all marked cells.
Here is a good article about doing a Mail-style multiple selection:
http://cocoawithlove.com/2009/01/multiple-row-selection-and-editing-in.html

how to create a view like a cell with disclosure accessory button?

I want to pop up a view when user touch on the screen,it is just like a tableview cell with disclosure accessory button.It has text showing message and when the user press the accessory button,it will take some action.
I have seen a similar example in iphone cookbook, it create a UICalloutView:UIControl,
but it seems that it uses some private API.
can anyone tell me how to achieved this?
Well, it's probably private. You could printScrn the accessory and add it as a resource to your project, and use it as an image.