在Objective-C中,将NSIntegers一起添加的最佳方法是什么?

时间:2010-09-14 14:32:43

标签: objective-c

此代码有效,如果少于十个项目,则隐藏搜索栏,但我不喜欢将转换为int。有没有更好的方法呢?

 if( kScreenFull > ((int)[[self tableView] numberOfRowsInSection:kReal] + (int)[[self tableView] numberOfRowsInSection:kIncome]) )
  [self.tableView setContentOffset:CGPointMake(0.0, 44.0) animated:NO];

1 个答案:

答案 0 :(得分:3)

你不需要强制转换为int。 NSInteger只是一台独立的机器。

实质上,NSInteger唯一不同的是,在64位系统上,它将是一个长的,而不是一个整数。