Can I do that NSTableView do not respond For automatically reloadData? for example when I click on hide program window, or some sing else? Another words update data in table must implement only when I call realoadData: method?
ps I sink may some method like - unableReload or else, but I can't find it(
I'm find the answer.
for solve this situation Focus Ring of TableView must be 'None':
[tableView setFocusRingType:NSFocusRingTypeNone];
Related
I've got two NSTableView in a single NSViewController, and each has their own NSArrayController to handle what exists. I'm now trying to wire up the Edit->Delete button. How do I know, when the delete method is called, 'who' sent that message?
Specifically I want to know whether I was clicked into the first table view or the second one when I then chose the Delete menu item. The 'sender' to the delete method is just the NSMenuItem so I can't back-track that to the table.
Get firstResponder of the window and follow nextResponder until you find a table view.
I am Creating a tableview using custom cell with textfield. When i enter text in tableviewcell textfield and when i scroll the tableview the data is changing . Means re painting cells . How can i stop reloading cell on drag or scroll in IOS 8 swift
Thanks
If your want your cell not re-used, try to make it a subclass of UITableViewCell with a unique identifier, and do not use the identifier with other cells. I haven't test it yet, just hope it will solve your problem.
Ps. If the textfield's text is still overwritten, make a check at the cell's class file (like making an if-else statement checking if the textfield's text is empty).
Detailed workflow:
In cellForRowAtIndexPath(), after you dequeue the cell, normally you will set some property of your custom cell to refresh the data it holds. To implement this, you need to add a didSet observer on the property at the cell's class file. To achieve the goal you want, you can also add the checking code in the didSet observer.
In Your case. You need to customize your keyboard.
Add [Prev][Next] buttons on top of the keyboard and avoid scrolling.
Basically this idea is useful in form based app. May be your doing that kind.
And yes, Stop relaoding of cells is not good to app. If you will implement this. Apple will not approve your app. So avoid this kind of stuffs.
This is how cells work in a UITableView. The standard implementation of the cellForRowAtIndexPath: method dequeues cells and reuses them.
And ideally your app should save the text from the text fields and change the correct text in the cells depending on their indexPath in the same method's implementation.
If you do not want to do that, a dirty workaround would be to create a new cell every time in the cellForRowAtIndexPath: method instead of dequeuing rows.*
*Do not do this unless absolutely necessary. This is very bad coding practice
I have UITableViewController with Edit/Save button as BarItem. I have a custom cell which displays UITextField in edit mode. I am able to save modified text when I move focus to another cell etc. no problem. However my problem begins when I attempt to modify a field and press Save button that triggers setEditing:NO save etc. What I believe is happening is a race condition where Save action is triggered before editingDidEnd is processed and as a result I am not saving all of the data.
Any suggestions on how to handle this? Am I to go through all visible cells to save all of the data on save? I can definitely do that, but am I going to get into same problem with scroll and edit button clicked? Is there a better way to flush messaging queue?
Given that I have no takers, I think I am stuck with what I know:
in done/save (i.e. setEditing:NO) handling go through all cells and save their data
Keep updating data every time there is a change i.e. in Value Changed perhaps
attempt using UITextFieldDelegate and textFieldShouldEndEditing but I am not sure this would work since I will probably run into the same problem that I have.
I believe endEditing inside setEditing will solve the problem as it supposed to resign first responders for text fields.
I'm implementing an example, in that example, I read in data from a database, put it in an array, sort it, and it's displayed using the RootViewController. The DB read and array load happen before the RVC code. So, it works, I get the data in the window created by the RVC and there's a nav controller there as well.
I want to add a button or something to the nav controller so that when you hit it, it sends a value back to the RootViewController.m file, then based on that value, I want to resort the array and display it once again in the RootViewController window.
I'm not sure how to do this. What changes would I have to make to the .xib and the RootViewController.m file?
Please, I'm a confused nube. %-0 Thank you very much.
There's a fair amount to this, so I'll give some general points and if any of them cause problems, it may be easier to work out smaller details.
In you RVC's viewDidLoad method, you can create a button and set it as the right or left button in your controller's navigationItem.
You can associate a tap on that button with a method in your controller that can do whatever you want when the button is tapped. (But a button doesn't send values, really, so you may have to explain more about that idea.)
I assume the RVC has a table view if you're showing array contents, so once the array (mutable array, I'd assume) is re-sorted, you can tell the table view to reload its data.
In answer to your secondary question, once you have resorted your array (or generally updated your data however you wish) you can force the table view to reload programmatically
[tableView reloadData];
Where 'tableView' is your instance variable pointing to your table view
I have a custom NSActionCell used to render some parts of some of the rows in my NSOutlineView. I can receive and respond to clicks on the NSActionCell, but the selection also changes when that cell is clicked. I'd like to prevent the selection from changing if one of my custom NSActionCells are clicked.
Is there an easy way to do this?
To answer my own question:
If the cell you want to be able to click (and subsequently not select a row) is in it's own column, then the following Apple example is very useful:
DragNDropOutlineView
That example relies on implementing the following NSOutlineViewDelegate method (implemented in AppController.m at line 304):
- (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item
If you have a cell within another cell, you can still use that approach, but you'll need to do a bit more work to determine whether the mouse was clicked within your sub-cell. A good example demonstrating that logic is the following Apple example:
PhotoSearch