ios - Having problems getting UIImageView to display correct image? -
ios - Having problems getting UIImageView to display correct image? -
okay weird basically, app collects weather info via json, parses , turns temperature , current conditions nsstrings, reason, i'm having 2 issues, never works in simulator, works on ios device, , can't show "scattered clouds" image, images stored in resources folder without file extension (scattered clouds instead of scattered clouds.png, ect) have been wondering if maybe code crap?
- (void)connectiondidfinishloading:(nsurlconnection *)connection { nserror *myerror = nil; nsdictionary *res = [nsjsonserialization jsonobjectwithdata:jsonresponse options:nsjsonreadingmutableleaves error:&myerror]; nsarray *results = [res objectforkey:@"current_observation"]; nsarray *cur = [results valueforkey:@"weather"]; nsarray *tmp = [results valueforkey:@"temp_f"]; nslog(@"current conditions: %@, %@ยบ", cur, tmp); nsstring *tmpstring = [tmp description]; nsstring *weatherimagestring = [cur description]; uiimage *weatherimage = [uiimage imagenamed:[nsstring stringwithformat:weatherimagestring]]; [weather setimage:weatherimage]; temp.text = [nsstring stringwithformat:@"%@%@", tmpstring,@"°"]; }
any thoughts? i'm wondering if there improve way might help solve these mysterious problems.. thanks..
ios xcode json nsstring uiimage
Comments
Post a Comment