Lan Yi Education Album

Source: Internet
Author: User

Lan Yi told me yesterday how to do photo albums and file Manager

Steps to write a photo album

1. Build the first page (Tableviewcontroller)

2. Create album (Album) object with properties for name and imagepaths array

3. When the first page is loaded, get the picture path below all the contents (there are beautiful Villa cars these folder names) to get the folder

Array of names, iterate over this array to get the name of each folder, get the full path to the folder, get the folder again under all

Picture Path, creates a album object based on the path of the currently traversed album folder to add a picture path to the Imagepaths array in the album object

4. The above acquisition will eventually result in a albums array with multiple album objects and this array is the data source for the current page.

5. Display the contents of the array in the current TableView

6. When clicking on a line, get the album object for this line to pass the object to the next page

7. Go to the second page and traverse through the album object inside the imagepaths array according to the picture path inside the interface

Add the Palace format button a row display 4 Let the picture button's tag value equals the value of the currently traversed I (that is, let the picture button know that it is the first few)

8. Add a click event to the Picture button when you click on the image, jump to the third page and pass the tag value of the button clicked.

This indicates that you clicked on the first few, jump page also need to transfer the current page of the album object to the third page

9 go to the third page create ScrollView displays each picture in the Imagepaths array in a album object to the interface in full screen

Set the offset value of the ScrollView to the tag value of the passed button to display the image you clicked.

There are some new codes that need to be mastered:

if ([FileName hasprefix:@. "]) {

Continue ?? Keep hidden files from appearing (if "." Start) jump out of this cycle

}

?? Stitching picture Full path (automatically add "/" to the previous path and file name)

NSString *imagepath = [FilePath stringbyappendingpathcomponent:imagename];

Height per row of cells

-(CGFloat) TableView: (UITableView *) TableView Heightforrowatindexpath: (Nsindexpath *) indexpath{

return 80;

}

Lan Yi Education Album

Related Article

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.