Another, probably simple problem that, having tried for a good few hours now I'm pretty stumped on. Simply, I want to set the value of a picker from a NSDictionary, I don't mind! Every way I have tried pretty much gives me the warning Passing argument 1 of selectRow inComponent animated' makes integer from pointer witout a cast. Which makes sense, though I seem to be failing miserable at fixing it! Any help would be greatly appreciated! Snippet of code below...
NSArray *myValue = [parsedJson objectForKey:@"Details"];
NSEnumerator *myEnumerator = [myValue objectEnumerator];
NSDictionary* myItem;
int i = 0;
while (myItem = (NSDiction开发者_运维百科ary*)[myEnumerator nextObject])
{
[myPickerView selectRow:[myItem objectForKey:@"Value"] inComponent:i animated:YES];
i++;
}
Assuming your value responds to intValue message (e.g. number is stored in NSNumber or NSString) then the following should work:
[myPickerView selectRow:[[myItem objectForKey:@"Value"] intValue]
inComponent:i animated:YES];
The selectRow parameter is expecting an integer, try this:
[myPickerView selectRow:[[myItem objectForKey:@"Value"] integerValue] inComponent:i animated:YES];
精彩评论