UIImageView不从iphone URL加载图像

UIImageView不从iphone URL加载图像,iphone,uiimageview,Iphone,Uiimageview,我有imageView我想从url加载图像,但它没有加载我正在使用以下代码 pdfView.hidden=NO; webView.hidden=NO; pictureImageView.hidden=NO; pdfView.backgroundColor=[UIColor clearColor]; doneButton = [[UIBarButtonItem alloc]initWithTitle:@" Done

我有imageView我想从url加载图像,但它没有加载我正在使用以下代码

               pdfView.hidden=NO;
       webView.hidden=NO;
       pictureImageView.hidden=NO;
      pdfView.backgroundColor=[UIColor clearColor];
      doneButton = [[UIBarButtonItem alloc]initWithTitle:@" Done " style:UIBarButtonItemStyleBordered target:self action:@selector(doneButtonClick)];            
      self.navigationItem.leftBarButtonItem =doneButton;
      webView.backgroundColor=[UIColor clearColor];


        NSLog(@"File Name is %@",fileName);

        NSLog(@"Enterning in the ImageSection");

        NSString *ImageURL = fileName;
        NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:ImageURL]];
            pictureImageView.image = [UIImage imageWithData:imageData];         
取而代之的是,如果我想从下面这样的本地提供,那么它也不会在imageView中显示图像,也不会知道如何从url加载图像

        pictureImageView.image=[UIImage imageNamed:@"starblue.png"];

首先设置该图像的帧,然后在
pictureImageView

            [self.view bringSubviewToFront:pictureImageView];
代码看起来不错

要检查的东西

  • Url包含有效的图像
  • 设置ImageView alloc它正确设置帧,然后添加图像
  • UIImageView*pictureImageView=[[UIImageView alloc]initWithFrame:CGRectMake(10,20,50,50)]
    然后做剩下的


    这是同步映像加载,将阻止主线程活动。首选使用AFNetworking或AsynchHimageView使用异步映像下载使用此代码在Url中显示映像

      NSString *image=[NSString stringWithFormat:@"Your URL"] stringByReplacingOccurrencesOfString:@" " withString:@"%20"];
      NSLog(@"%@",image);
      NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:image]];
     Yourimageview=[UIImage imageWithData:imageData];
    

    imageUrl包含图像?您是否为pictureImageView指定了一个框架?错误的代码格式..@LithT.V是imageUrl包含img路径我已从IByes添加了pictureImageView,但可能是您添加到它上的某个视图,这会在视图中出现问题,并且您的pictureImageView未显示,因此在添加此UIImage中的任何图像后,请首先正确设置框架在您的项目中可用,并添加我的上述行,然后让我知道您得到了什么…:)我希望它对你有用…谢谢它工作基本上我没有错误地连接插座谢谢它工作我想问一些事情我有imageView,里面有两个按钮添加反馈和库我想当我点击单元格内的按钮时,它应该指向所选单元格,因此如何获得单元格当前位置你的意思是什么没错,伙计??
      NSString *image=[NSString stringWithFormat:@"Your URL"] stringByReplacingOccurrencesOfString:@" " withString:@"%20"];
      NSLog(@"%@",image);
      NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:image]];
     Yourimageview=[UIImage imageWithData:imageData];