Reputation: 1981
I am getting a warning while doing this
CGFloat viewHeight = ([self.quotaArray count]*kROW_HEIGHT) + kHEADER_HEIGHT + kFOOTER_HEIGHT;
Basically this math statement returns me the height of my table view, which is the
(number of rows * row height) + header height + footer height
What am I doing wrong?
Upvotes: 0
Views: 707
Reputation: 57168
My guess: You have something like:
#define kHEADER_HEIGHT 3;
So, the line of code you give turns into:
CGFloat viewHeight = ([self.quotaArray count]*1) + 3; + 2;
Which is valid; the last part produces a warning. (+2
is a valid expression, which does nothing but produce the value 2, hence the warning.)
So, remove the semicolon from your define, or, even better, stop using #define
when a static const int would do. (Because you can't get crazy errors like this if you're just using an int.)
Upvotes: 4
Reputation: 20410
Are you using the variable after it? That warning is telling you that you created a CGFloat called viewHeight and not using it in your code
Upvotes: 0