uiscrollview add images

uiscrollview add images

How to add dynamic images to UIScrollView?

View Answers

July 27, 2011 at 4:19 PM

To add images to a scroll view, get those images in an array

NSArray *imageFilenames = [NSArray arrayWithObjects:@"abc.png","one.png",nil];

And then,

CGFloat contentOffset = 0.0f;

for (NSString *singleImageFilename in imageFilenames) 
{  
   CGRect imageViewFrame = CGRectMake(contentOffset,110.0f,scrollView.frame.size.width,_scrollView.frame.size.height-30.0f);
   UIImageView *imageView = [[UIImageView alloc] initWithFrame:imageViewFrame];
    imageView.image = [UIImage imageNamed:singleImageFilename];
    imageView.contentMode = UIViewContentModeCenter;
    [scrollView addSubview:imageView];
    [imageView release];
    contentOffset += _scrollView.frame.size.width;
    scrollView.contentSize = CGSizeMake(contentOffset, scrollView.frame.size.height);
}

scrollview.contentSize and imageViewFrame should be adjusted to our needs

Hope it helps,

-Dinny


March 24, 2012 at 6:35 PM

its really nice.. great job









Related Tutorials/Questions & Answers:
uiscrollview add images
uiscrollview add images  How to add dynamic images to UIScrollView
Add UIImageView to UIScrollVIew
. See the given code it might help you... Add UIImageView to UIScrollVIew - (id...Add UIImageView to UIScrollVIew  How can i add UIImageView to UIScrollview? I have already created both UIIMageView and ScrollView programmatically
Advertisements
UIScrollView Height
UIScrollView Height  How can i set the height and width of the UIScrollView according to my requirement. Actually i'm creating a login application form iPhone and using UIScrollView. Also i have number of item to add
uiscrollview background color
uiscrollview background color  Is it possible to set the uiscrollview background color in iPhone application
uiscrollview setcontentoffset animated
uiscrollview setcontentoffset animated  Hi, What is actual code to call uiscrollview setcontentoffset animated method? Thanks   Hi, Here...   when and where i should use setcontentoffset UIScrollView
UIScrollView Toolbar problem
and drop the uiscrollview set the length as 320*460 Now, add the UIToolBar...UIScrollView Toolbar problem  Hi, I am creating a UINavigation based... or viewWillApear method just add the given lines of code. CGRect scrollFrame
uiscrollview remove all subviews
uiscrollview remove all subviews  Hi, How to remove all elements from uiscrollview. I need code for uiscrollview remove all subviews. Thanks   Hi, You can use following code in your program to remove all sub childs
UIImageView UIScrollView Zoom
UIImageView UIScrollView Zoom   I am trying to implement a Zoomin / Zoomout feature in UIImageView and wanted to have the scroll capability init.   UIImageView *tempImage = [[UIImageView alloc]initWithImage:[UIImage
UIScrollView Example iPhone
UIScrollView Example iPhone UIScrollView is the superclass of several... need UIScrollView when our text length or form size is larger then the actual... out how to add scroll view to your application. You can accomplish
Images in java
Images in java  how to handle images in java
inked images
inked images  How do I eliminate the blue border around linked images
Moving The Images
Moving The Images  How to moving multiple images in one frame using swings
images upload
images upload  I use netbeans IDE 6.8 How i upload any image from any folder to web page
images
jsp images
jsp images  hi I had done a demo application using jsp. And i tried to display some images which is located in the server folder. It has done by using the IP address path of that image folder.. It has been success full in IE
insert images into a Mysql database
insert images into a Mysql database  How can I insert images into a Mysql database
Adding images in itext pdf
Adding images in itext pdf  Hi, How to add image in pdf file using itext? Thanks   Hi, You can use following code: PdfWriter.getInstance(document,new FileOutputStream("imagesPDF.pdf")); Read more at Inserting
ModuleNotFoundError: No module named 'images'
ModuleNotFoundError: No module named 'images'  Hi, My Python... 'images' How to remove the ModuleNotFoundError: No module named 'images'... to install padas library. You can install images python with following command
HTML background images
HTML background images  How can I specify background images
Sending images through java mail
Sending images through java mail  Am trying to develop greeting application that having images..... in one jsp page i displayed all images and by clicking one image the control go to mail sending page in that the image should add
Displaying images - JDBC
Displaying images  How to display multiple images on a single jsp from MySql database
Displaying images - JDBC
Displaying images  How to display multiple images on a single jsp from MySql database
Moving Images in GUI - Swing AWT
Moving Images in GUI  I want to add an image of a person in my GUI and make it move to a specific location. How can I add the image to the frame and move
background images in css not working
background images in css not working  In the application i'm passing a background image from CSS in the given format ... background-image: url... of adding background images in css
WHAT TYPES OF IMAGES THAT PHP SUPPORTS?
WHAT TYPES OF IMAGES THAT PHP SUPPORTS?  WHAT TYPES OF IMAGES THAT PHP SUPPORTS
how to space images in html code
how to space images in html code  how to space images in html code
Blob images - JSP-Servlet
Blob images  Hi sir how can i retrieve blob images from database using jsp from mysql  Hi Friend, Please visit the following link: http://www.roseindia.net/jsp/retrieve-image.shtml Hope that it will be helpful
upload images - JSP-Servlet
upload images  How to write the jsp code to upload images into database.   Hi Friend, The link we have provided you will allow you to upload any file therefor it can also upload an image and can insert
need photoes,images - JavaMail
need photoes,images  hi this is nagarjuna. i need james binary server2.3.1 architecture. and i dont know about how it works. i have to give one seminar on mailing technology. so pls send the gif images,and some
regarding images in jsp
regarding images in jsp  Hi, When I am trying to display an image in jsp, i am getting the image of bar charts in webroots/jspchart/web/jspbarchart.jsp.. But actually I am not getting any image in the browser.. Can any one help
java mail sending with images
java mail sending with images  I need to send images through java mail without giving content path(i.e. we don't want hard code the image path)can you tell me the idea?   Please visit the following links: http
how to display multiple images on browser
how to display multiple images on browser  i want to display multiple images on brower including string values from sql database using jsp
how to display multiple images on browser
how to display multiple images on browser  i want to display multiple images on brower including string values from sql database using jsp
ModuleNotFoundError: No module named 'artek-images'
ModuleNotFoundError: No module named 'artek-images'  Hi, My Python... 'artek-images' How to remove the ModuleNotFoundError: No module named 'artek-images' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'compare-images'
ModuleNotFoundError: No module named 'compare-images'  Hi, My... named 'compare-images' How to remove the ModuleNotFoundError: No module named 'compare-images' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'optimize-images'
ModuleNotFoundError: No module named 'optimize-images'  Hi, My... named 'optimize-images' How to remove the ModuleNotFoundError: No module named 'optimize-images' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'pinax-images'
ModuleNotFoundError: No module named 'pinax-images'  Hi, My Python... 'pinax-images' How to remove the ModuleNotFoundError: No module named 'pinax-images' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'web-images'
ModuleNotFoundError: No module named 'web-images'  Hi, My Python... 'web-images' How to remove the ModuleNotFoundError: No module named 'web-images' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'artek-images'
ModuleNotFoundError: No module named 'artek-images'  Hi, My Python... 'artek-images' How to remove the ModuleNotFoundError: No module named 'artek-images' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'compare-images'
ModuleNotFoundError: No module named 'compare-images'  Hi, My... named 'compare-images' How to remove the ModuleNotFoundError: No module named 'compare-images' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'django-images'
ModuleNotFoundError: No module named 'django-images'  Hi, My... 'django-images' How to remove the ModuleNotFoundError: No module named 'django-images' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'gcse_images'
ModuleNotFoundError: No module named 'gcse_images'  Hi, My Python... 'gcse_images' How to remove the ModuleNotFoundError: No module named 'gcse_images' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'images-utils'
ModuleNotFoundError: No module named 'images-utils'  Hi, My Python... 'images-utils' How to remove the ModuleNotFoundError: No module named 'images-utils' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'annotated-images'
ModuleNotFoundError: No module named 'annotated-images'  Hi, My... named 'annotated-images' How to remove the ModuleNotFoundError: No module named 'annotated-images' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'artek-images'
ModuleNotFoundError: No module named 'artek-images'  Hi, My Python... 'artek-images' How to remove the ModuleNotFoundError: No module named 'artek-images' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'artek-images'
ModuleNotFoundError: No module named 'artek-images'  Hi, My Python... 'artek-images' How to remove the ModuleNotFoundError: No module named 'artek-images' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'compare-images'
ModuleNotFoundError: No module named 'compare-images'  Hi, My... named 'compare-images' How to remove the ModuleNotFoundError: No module named 'compare-images' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'dockerbuild-images'
ModuleNotFoundError: No module named 'dockerbuild-images'  Hi, My... named 'dockerbuild-images' How to remove the ModuleNotFoundError: No module named 'dockerbuild-images' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'Flask-Images'
ModuleNotFoundError: No module named 'Flask-Images'  Hi, My Python... 'Flask-Images' How to remove the ModuleNotFoundError: No module named 'Flask-Images' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'minchin.pelican.plugins.optimize-images'
ModuleNotFoundError: No module named 'minchin.pelican.plugins.optimize-images...: ModuleNotFoundError: No module named 'minchin.pelican.plugins.optimize-images' How...;minchin.pelican.plugins.optimize-images' error? Thanks   Hi, In your python

Ads