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.

For example:

– 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;)

Answers


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 !


Will:

Used to signify that something will happen (about to happen). Kind of like 'I will go to the store'.

Did:

Used to signify that something did happen (has happened). Kind of like 'I did go to the store'.

Should:

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?'

viewWillAppear

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!"


Need Your Help

Confusion on .equals method

java

Suppose I have a class Employee:

NDB projection & caching questions

google-app-engine python-2.7 gae-datastore

I have a couple of doubts regarding how NDB projection queries work and how the caching behaves behind the scenes

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.