Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/99.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 图像未显示在UIScrollView上_Ios_Objective C_Uiimageview - Fatal编程技术网

Ios 图像未显示在UIScrollView上

Ios 图像未显示在UIScrollView上,ios,objective-c,uiimageview,Ios,Objective C,Uiimageview,所以我有一个UIScrollView和滚动工作。我在上面加了个标签,它也滚动了一下。但是,当我添加图像视图时,滚动可以正常工作,但图像不会显示,因此出现以下错误: Could not load the "block" image referenced from a nib in the bundle with identifier 我的ViewController.m: @interface ViewController : UIViewController{ IBOutlet UIS

所以我有一个UIScrollView和滚动工作。我在上面加了个标签,它也滚动了一下。但是,当我添加图像视图时,滚动可以正常工作,但图像不会显示,因此出现以下错误:

Could not load the "block" image referenced from a nib in the bundle with identifier
我的ViewController.m:

@interface ViewController : UIViewController{
    IBOutlet UIScrollView * scroller;
}

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [scroller setScrollEnabled:YES];
    [scroller setContentSize:CGSizeMake(320, 600)];  
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

@end
我已禁用“使用自动布局”,将大小更改为“自由形式”,并将视图高度更改为600


有没有关于如何实现这一点的想法?

是您试图加载的图像命名块?您是否在Interface Builder中看到该图像的预览?图像的文件类型是什么?是的,它显示在XCode中,但不显示在iOS刺激器中。它是一个名为“block.PNG”的PNG,位于支持文件目录中。我删除了所有添加的代码和滚动视图,它显示得很好,但与添加的文件不兼容。文件引用在哪里,您确定它不是保存为block.png的photoshop图像吗?这种事经常发生。实际上你是对的。。。这有点尴尬。。。