PDA

View Full Version : method not fully implement / method not find?‏




inzaghi0507
Jul 25, 2010, 02:48 AM
well I am new to iPhone develop.
Recently, I try to do some tableview application,and I follow the book`s example, but I met some problem.



In the .h file I use the two protocol <UITableViewDelegate, UITableViewDataSource>.
The problem is when I try to type the two functions numberOfRowInSection and cellForRowAtIndexPath,
it doesn`t work, and the xcode show me “NO Completions found”.

Then , compile with some warning, just like the puctures below:

http://img689.imageshack.us/img689/5598/macosxleopard2010072222.png

http://img708.imageshack.us/img708/5598/macosxleopard2010072222.png


It is ridiculous that when I try to paste the book`s example code into my .m file, it is works magically!

I compare the two codes which are the book`s example and I type, anything different is not find.



The question bother me, and I can`t find how to handle it,
please tell me why and how to solve it, THX

and the project file is below:



Thomas Harte
Jul 25, 2010, 05:40 AM
Xcode doesn't always spot all potential autocompletions — it's a helpful tool but it isn't authoritative. Just type the whole name for yourself.

inzaghi0507
Jul 25, 2010, 05:53 AM
thnaks for your opinion~~
well, i have tried to type the function by myself, not copied from the example

but it still not work:mad:

only one way to make it work is copy the example:confused:

Thomas Harte
Jul 25, 2010, 07:34 AM
Looking at the project you attached, you've named your method:

-(NSInteger)tableView:(UITableView *) tableView numberOfRowInSection :(NSInteger)section{


When it should be:

-(NSInteger)tableView:(UITableView *) tableView numberOfRowsInSection :(NSInteger)section{


i.e. rows is plural. You've made a typo, but the fact that Xcode didn't guess the correct autocompletions isn't relevant.