In Objective-C, what is the best way to add NSIntegers together?
This code works, hide the search bar if less than ten items, but I don't like the casts to int. Is there a better way to do it?
if( kScreenFull > ((int)[[self tableView] numberOfRowsInSection:kReal] + (int)[[self tableView] numberOfRowsInSection开发者_开发知识库:kIncome]) )
[self.tableView setContentOffset:CGPointMake(0.0, 44.0) animated:NO];
You don't need the casts to int. NSInteger is just a machine independent int.
In essence the only thing different about NSInteger is that on a 64bit system, it will be a long, not an int.
精彩评论