iOS 프로젝트 개발 실전-UIImageView 사용 및 이미지 디 스 플레이 모드
1758 단어 iOS 개발iOS 개발 기술 공유
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// ; , ;
UIImage *image = [UIImage imageNamed:@"img"];
// ; UIImageView;
UIImageView *imgView = [[UIImageView alloc]init];
// ;
// , UIImageView ;
imgView.frame = CGRectMake(10, 100, 300, 500);
imgView.backgroundColor = [UIColor yellowColor];
[imgView setImage:image];
[self.view addSubview:imgView];
// ;
/*
UIViewContentModeScaleToFill,
UIViewContentModeScaleAspectFit, // contents scaled to fit with fixed aspect. remainder is transparent
UIViewContentModeScaleAspectFill, // contents scaled to fill with fixed aspect. some portion of content may be clipped.
UIViewContentModeRedraw, // redraw on bounds change (calls -setNeedsDisplay)
UIViewContentModeCenter, // contents remain same size. positioned adjusted.
UIViewContentModeTop,
UIViewContentModeBottom,
UIViewContentModeLeft,
UIViewContentModeRight,
UIViewContentModeTopLeft,
UIViewContentModeTopRight,
UIViewContentModeBottomLeft,
UIViewContentModeBottomRight,
*/
// ;
// :UIViewContentModeScaleToFill ;
/*
UIViewContentModeScaleToFill: ;
UIViewContentModeScaleAspectFit: , ;
UIViewContentModeScaleAspectFill: , ;
*/
imgView.contentMode = UIViewContentModeScaleAspectFill;
}
@end
github 홈 페이지:https://github.com/chenyufeng1991 。여러분 의 방문 을 환영 합 니 다!
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
iOS 프로젝트 개발 실전-UIImageView 사용 및 이미지 디 스 플레이 모드현재 우 리 는 iOS 의 Image 컨트롤 을 사용 하여 그림 을 표시 하고 그림 의 표시 모드 를 설정 합 니 다.코드 는 다음 과 같 습 니 다. github 홈 페이지:https://github.com/che...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.