프로그래밍 방식으로 배경 이미지를로드하려고하지만 이미지가 표시되지 않습니다.UIImageView에서 이미지를로드하는 iOS가 표시되지 않습니다.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self)
{
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"image" ofType:@"png"];
UIImage *backGroundImage = [UIImage imageWithContentsOfFile:filePath];
self.backGroundView = [[UIImageView alloc] initWithImage:backGroundImage];
self.backGroundView.hidden = NO;
}
return self;
}
콘솔에게 UIImageView에 인쇄하는 경우 : 여기 내 코드는
po _backGroundView
<UIImageView: 0x15d40cf0; frame = (0 0; 568 320); opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x15d41fb0>>
이미지가 화면에로드되지 않는 이유 당신의 상관 알고 있습니까?
가'뷰 계층에 추가되는 self.backGroundView' 있습니까? – Stonz2
스토리 보드를 사용하고 있습니까? filePath가 유효합니까? [UIImage imageNamed : @ "xxx"]로로드하려고 했습니까? ? – jomafer