2011-11-14 1 views

答えて

2
UIImage *pImage=[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:imageURL]]];; 
    [imageView setImage:pImage]; 
5
UIButton *myButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 
myButton.frame = CGRectMake(20, 20, 200, 44); // position in the parent view and set the size of the button 
[myButton setTitle:@"Click Me!" forState:UIControlStateNormal]; 
// add targets and actions 
[myButton addTarget:self action:@selector(buttonClicked) forControlEvents:UIControlEventTouchUpInside]; 
// add to a view 
[superView addSubview:myButton]; 

と機能

-(void)buttonClicked{ 
    //urlString should be your image url which you want to access 
    NSURL *url = [[NSURL alloc] initWithString:urlString ]; 
    NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url]; 
    NSData *urlData = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:&response error:nil]; 
    UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:url]]; 
} 

表示したいの使用イメージ.........

+0

ここ応答&何ですか? – Ans

関連する問題