[self backgroundImages][[NSNumber numberWithInt:barMetrics]] = backgroundImage;
How can I solve this warning?
[self backgroundImages][[NSNumber numberWithInt:barMetrics]] = backgroundImage;
How can I solve this warning?
To get rid of the warning use
[NSNumber numberWithInteger:metrics]
or
[NSNumber numberWithInt:(int)metrics]
because metrics is an NSInteger and numberWithInt accepts int not NSInteger.
But what you really want is
[self backgroundImages][(int)metrics];
You try to pass NSNumber as a index to your array but you should pass int instead:
[self backgroundImages][It should be an int number]
I assume backgroundImages is array. BarMetrics is an UIBarMetrics type you cannot pass it as an int.
You can do something like that:
int i = -1;
if (barMetrics == UIBarMetricsDefault)
i = 0;
if (barMetrics == UIBarMetricsLandscapePhone)
i = 1;
// and so on....
[self backgroundImages][i]