代码之家  ›  专栏  ›  技术社区  ›  David

如何在objective c中访问GoogleAPI图表(对于iphone)?

  •  1
  • David  · 技术社区  · 16 年前

    2 回复  |  直到 16 年前
        1
  •  2
  •   Mayur Birari    15 年前

    -(iAction)按钮按下:(id)发件人{

    NSLog(@"button pressed");
    
    //|=%7c [pipe], you can used NSString *myurl=[yoururl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    
    NSString* myurl=@"your google chart url";
    
    NSMutableURLRequest *theRequest=[NSMutableURLRequest requestWithURL:[NSURL URLWithString:myurl] cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                        timeoutInterval:60.0];                                              
    
    NSURLResponse* response;
    NSError* error;
    NSData *imageData=[NSURLConnection sendSynchronousRequest:theRequest returningResponse:&response error:&error];
    NSLog(@"%@",error); 
    NSLog(@"%@",response);
    NSLog(@"%@",imageData); 
    
    UIImage *myimage = [[UIImage alloc] initWithData:imageData];
    
    self.ringImge.image=myimage;
    

    }

        2
  •  0
  •   David    16 年前

    对不起,上面的回复有一处改动。

    NSString*myurl=[yoururl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];