0
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index

Why do these methods return an NSInteger instead of a NSUInteger? I actually doesn't make sense.

1

2 Answers 2

0

I believe it is because there are times where it would return a negative number, like -1, to indicate an error. However this may never be seen to you as the class might handle the translation.

I'm assuming you know that an nsuinteger is an unsigned integer and can't be negative.

-1

Because all above three method minimum value is 0. means last object is always zero. so, here take an NSInteger. Below value are not possible in that method.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.