Ui_uiimageview Basic Operation

Source: Internet
Author: User

Ui_uiimageview Common methods
//Use ImageView to find a picture by name    UIImage*image = [UIImageimagenamed:@"Bg_2"];//Add image to ImageView    Uiimageview*imageview = [[UiimageviewAlloc] initwithimage:image];//Set picture position and sizeImageView. Frame= CGRectMake ( +, +, -, the); ImageView. BackgroundColor= [UicolorRedcolor];//Set TransparencyImageView. Alpha=0.5;//Add a click event for a picture    //userinteractionenabled is YES to respond to click eventsImageView. userinteractionenabled=YES;//Set pictures to interact    //Set gesturesUITapGestureRecognizer *singletag = [[UITapGestureRecognizer alloc] Initwithtarget: SelfAction@selector(Tapimageview:)];//Add gestures[ImageView Addgesturerecognizer:singletag];//Show/Hide YES to hideImageView. Hidden=NO;//Get pictures from the network    UIImage*netimage = [UIImageImagewithdata:[nsdata datawithcontentsofurl:[Nsurlurlwithstring:@"www.google.com"]]];//Add image to window and free memory[ Self. WindowAddsubview:imageview];    [ImageView release]; ImageView =Nil;//Safe release
Dynamic graphs
    Uiimageview*imageview = [[UiimageviewAlloc] initwithimage:[UIImageimagenamed:@"1.tiff"]]; ImageView. Frame= CGRectMake ( +, -, -, -);//Add a set of pictures to ImageView    Nsmutablearray*array = [NsmutablearrayArray]; for(inti =1; I <5; i++) {//NSString *name = [NSString stringwithformat:@ "00%d.tiff", I];//UIImage *image = [UIImage imagenamed:name];        //The above two sentences can be combined as one sentence        UIImage*image = [UIImageimagenamed:[NSStringstringwithformat:@"%d.tiff", I]];    [Array addobject:image]; }//Put the array in the ImageViewImageView. Animationimages= array; [ SelfAddsubview:imageview];//Play TimeImageView. Animationduration=0.4F//Play CountImageView. Animationrepeatcount=0;//0 is an infinite number of times    //Start animation[ImageView startanimating];//End Animation "//[ImageView stopanimating];

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Ui_uiimageview Basic Operation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.