Is it okay to return an NSUInteger from tableView:numberOfRowsInSection?
I am working on a simple Table View iOS application, and I want to display a cell for each entry in an NSMutableDictionary. Here is the code I am currently using:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
开发者_JS百科 return [myDict count];
}
It is my understanding that the count method of an NSMutableDictionary returns an NSUInteger. Will there ever be any issues that I need to watch out for using the code above?
No there will not be any issues since count is always a 0 or greater number, it is ok for it to return an unsigned integer.
精彩评论