Get cell title from table view - objective-c

I have a custom table view and each cell has a title and a button. When the user clicks on the button, I need the title of that cell to appear on another view. How do I get this?

It's not very tough here are the 2 solutions:
When you are creating the cell, assign tag to the label you want to get the title value (or text value)
second option is:
If you want to get the title at the didselect select method just get the cell from the table view with the help of indexpPath.row and then extract the label and it's text. You can assign the tag in the custom cell design and then extract it from cell (once you get the cell).

Related

Objective C-OSX How to change color of NSTableViewCell when selecting?

there are 3 cell in my table view
my table is view base table
my requirement is when i select any cell(click on any row) text color and background color of that(selected cell) table view cell change
A naive solution could be using NSTableViewDelegate declared as tableViewSelectionDidChange:. Inside it use the property selectedRowIndexes, which will provide the currently selected rows. Then customize those cell as you want (changing the background color or whatever else).
NB :: don't forget to clear the cell's which are not in the selectedRowIndexes, otherwise deselcting won't change their state

Handling tableview cell selection from other view controllers

I have a tableView with custom table cells which displays a list of sayings. While selecting a cell (say "saying1") from the tableView, the cell will get selected and will moves to next view controller for showing an explanation of selected saying. In that view controller two buttons "Previous" and "Next" are there for navigating to previous and next saying. So user may select next button for seeing next saying (say "saying2"). But the problem here is, In this stage when i navigate back to my tableview, the cell selected will be "saying1" not "saying2".
In order to solve this problem, i collected the currently selected sayings ("saying2's") index from array (ie,index will be 1) and passed it to the previous tableView through segue and converted that value into NSIndexpath. After this step i don't know what to do. Please help me in solving this.
You can specifically select a cell by calling following method present in UITableView class :
selectRowAtIndexPath:animated:scrollPosition:
refere to following link : https://developer.apple.com/library/ios/documentation/uikit/reference/UITableView_Class/Reference/Reference.html#//apple_ref/occ/instm/UITableView/selectRowAtIndexPath:animated:scrollPosition:

How to get specific cell content in wxListCtrl

As the title said, can anyone give me a simple example how to get a specific cell's content in wxListCtrl.
For example, I build a wxListCtrl list, there may be 3 columns. When I Right click or Double click on one row, then it should popup a message box to give me the content in third column of this selected row?
Use wxListCtrl::GetItemText() to retrieve the contents of a cell.

Disable Delete for 1 Cell in UITableView

I have a UITableView. It pulls information from the address book where needed. I also have the bottom cell programatically made to be a button that loads up the address book.
My problem is when I allow the user to delete a row by swiping right, it shows it for the last cell I have made as a button. Is there a way to not allow a delete function showing on just 1 cell?
Implement tableView:canEditRowAtIndexPath: in the table view's dataSource and return NO for the row you don't want to be deletable.
You have to implement [UITableViewDelegate tableView:editingStyleForRowAtIndexPath:] and return UITableViewCellEditingStyleDelete only for the cells that can be deleted. Return UITableViewCellEditingStyleNone for the cells that can't be deleted.

Clear text of UITextField in UITableView cell on button press

I have a table view with two rows, each with a text field. One text field is for username and the other for password. When I click on a button, I want to clear both fields and replace the contents with the intial placeholders.
I tried [mytableview reloadData];. That just reloads the table view; the text fields are not cleared. The placeholders are appearing over the text entered while editing the text field, and the next time I try to edit the text field, the text is drawn over the first text.
on your button click:-
do yourtextfieldname.text=#"";
or if you have made a text field in table view methods so in that condition on your button click do [tableView reloadData] and at cellForRowAtIndexPath write yourtextfieldname.text=#"";
and set placeholder also.