开发者

Is it okay to return an NSUInteger from tableView:numberOfRowsInSection?

开发者 https://www.devze.com 2023-03-22 20:22 出处:网络
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:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消