uiscrollview add images

Ads
 

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

Ads









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
add
How to add two int numbers in Java Example  How to add two int numbers in Java Example  Here is a java example that accepts two integer from the user and find their sum. import java.util.*; class AddNumbers
add
Java Program to add two numbers  Java Program to add two numbers  Here is a java example that accepts two integer from the user and find their sum. import java.util.*; class AddNumbers { public static void main
add
How to add two numbers in Java  add two number   Here is a java example that accepts two integer from the user and find their sum. import java.util.*; class AddNumbers { public static void main(String[] args
add
Java Example to add two numbers  Java Example to add two numbers  Here is a java example that accepts two integer from the user and find their sum. import java.util.*; class AddNumbers { public static void main
add
add two no in Java  Java Add Example that accepts two integer from the user and find their sum  Here is a java example that accepts two integer from the user and find their sum. import java.util.*; class AddNumbers
Images in java
Images in java  how to handle images in java
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
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
images
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
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
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
add
how to space images in html code
how to space images in html code  how to space images in html code
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
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
Add Employee
Add Employee  coding for adding an employee
ModuleNotFoundError: No module named 'alice-images'
ModuleNotFoundError: No module named 'alice-images'  Hi, My Python... 'alice-images' How to remove the ModuleNotFoundError: No module named 'alice-images' 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

Ads