9.17. Use of image view

发布时间 : 2025-10-25 13:32:31 UTC      

Page Views: 9 views

An image view is used to display an image of a single image or animation sequence.

Important attribute

  • Image

  • HighlightedImage

  • UserInteractionEnabled

  • AnimationImages

  • AnimationRepeatCount

9.17.1. An important method

- (id)initWithImage:(UIImage *)image 
- (id)initWithImage:(UIImage *)image highlightedImage: (UIImage *)highlightedImage 
- (void)startAnimating 
- (void)stopAnimating 

9.17.2. Add a custom method addImageView

-(void)addImageView{ UIImageView *imgview = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 300, 400)]; [imgview setImage:[UIImage imageNamed:@"AppleUSA1.jpg"]]; [imgview setContentMode:UIViewContentModeScaleAspectFit]; [self.view addSubview:imgview]; } 

Add another custom method addImageViewWithAnimation

This method explains how to animate images in imageView.

-(void)addImageViewWithAnimation{ UIImageView *imgview = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 300, 400)]; // set an animation imgview.animationImages = [NSArray arrayWithObjects: [UIImage imageNamed:@"AppleUSA1.jpg"], [UIImage imageNamed:@"AppleUSA2.jpg"], nil]; imgview.animationDuration = 4.0; imgview.contentMode = UIViewContentModeCenter; [imgview startAnimating]; [self.view addSubview:imgview]; } 

注意: 我们必须添加命名为”AppleUSA1.jpg”和”AppleUSA2.jpg”到我们的项目,可以通过将图像拖到我们导航区域,其中列出了我们的项目文件所做的图像。

Update viewDidLoad in ViewController.m, as shown below

(void)viewDidLoad { [super viewDidLoad]; [self addImageView]; } 
《地理信息系统原理、技术与方法》  97

最近几年来,地理信息系统无论是在理论上还是应用上都处在一个飞速发展的阶段。 GIS被应用于多个领域的建模和决策支持,如城市管理、区划、环境整治等等,地理信息成为信息时代重要的组成部分之一; “数字地球”概念的提出,更进一步推动了作为其技术支撑的GIS的发展。 与此同时,一些学者致力于相关的理论研究,如空间感知、空间数据误差、空间关系的形式化等等。 这恰好说明了地理信息系统作为应用技术和学科的两个方面,并且这两个方面构成了相互促进的发展过程。