I am having a tableView which lists the contents of a directory which includes jpg, pdf, zip, mp3, mp4, sql,.. files and even folders. For the next step, I am having a detailView which displays some properties of the selected file such as fileName, fileSize, filePath, fileType. Everything works perfect.
But actually my plan is to include a additional option in the detailView.
That is,
- If the selected file in the tableView is a image file, it should open a imageView in the detailView to display that image.
- If the selected file is a mp3, it should open a player to play the song in the detailView.
- If the selected file is a video or mp4 file, it should open a player to play that video in detailView.
- If the selected item is a folder, it should again open a tableView which dispalys the contents of the folder.
- For other files, it should push a alertView regarding that it is a unknown file.
Hope my concept was narrated. Please help me to proceed with some sample codes. Thank you in advance..
Create a dynamic detailView, a controller to handle images, a controller to handle video, etc. based on the file type.
For example (refer to the Sample SplitViewController provided by Apple):