Mechanism about “did” and “will” and “should” method
I want to know generally when the methods including the key words stated in the topic were called.
– tableView:willSelectRowAtIndexPath: – tableView:didSelectRowAtIndexPath: - (BOOL)tableView:(NSTableView *)aTableView shouldSelectRow:(NSInteger)rowIndex
When will the willSelectRow method called? What does the method mean by including the key words "will" "did" and "should"
Similarly, there are viewDidAppear and viewWillAppear. It's obvious when the viewDidAppear method called. But the viewWillAppear one is quite beyond me.
Hope that someone could help;)
willSelectRow: Tells the delegate that a specified row is about to be selected.
didSelectRow: Tells the delegate that the specified row is now selected.
should: Returns whether the table view should allow selection of the specified row.
It works the same way with viewDidAppear and viewWillAppear.
viewDidAppear: the view has already appeared.
viewWillAppear: the view is about to appear.
You can learn more in the apple documentation.
I hope that helped !
Used to signify that something will happen (about to happen). Kind of like 'I will go to the store'.
Used to signify that something did happen (has happened). Kind of like 'I did go to the store'.
Almost always used as a delegate method that returns a BOOL. For example,
- (BOOL)tableView:(NSTableView *)aTableView shouldSelectRow:(NSInteger)rowIndex
The table view is asking you if you would like to allow the row at the index specified to be selected at this point in time. Like you asking someone, 'Should I go to the store?'
There's really nothing special about this - it's just the system telling your view controller, "hey, your view is about to show onscreen, you better get ready!"