tags:

views:

167

answers:

1

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];
+1  A: 

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.

Jacob Relkin
Thanks. Initially 2 + 2 == syntax/type/error; ...some time later... after some complicated successes with NSNumber I got it back down to (int)2 + (int)2 == 4; Phew! Now it seems that 2 + 2 == 4; so there is a god after all.
Robin Pain