Simple slideshow in a UIImageView - objective-c

I got trouble to add slideshow to my application.
Currently, I have a UIView composed of a segmentedControl.
I made ​​two "views" that I hide or display depending on the selected button.
I'm looking to make a simple slideshow in one of my two views. I made a UIImageView because it is simple to display pictures.
So I'd like to display my pictures one by one and it is possible to move from one image to another by sliding your finger to the right or left (just as in the native app "Photos").
I tried to adapt example codes from the documentation, but without succes.
So I'ml looking for help.
Thanks,
jb crestot

SO, I've actually done this and it's fairly easy. The ingredient that you are missing is a UISCrollView. My implementation did exactly what you describe (allow the user to go back and forth between a set of images).
Basically, add a UIScrollView to your View in interface builder and you will be creating the UIImage views with code (a simple for loop) and setting their images the same way. I did this safely with no memories issues with about 15 images (PNG's). There could be a potential performance issue with this message if you are working with a large number of images (say 40?)
I hope this helps, let me know if you need a code sample to see how this works.

You may consider using a custom class, such as iCarousel, linked below. Each of these views could be your image, and then tapping on them could launch a fullscreen view for example.
Keep us posted!
http://cocoacontrols.com/platforms/ios/controls/icarousel

See apple's page control sample application.

Related

Gesture recognizer for tap event at specific positions on the screen

I am displaying hundreds of thumbnails in my view . I know default way to handle tap on thumbnail is using UICollectionView delegate method "didSelectItemAtIndexPath" but since its many thumbnails i wanted to look into adding gestures to the screen position so when i tap on a particular spot on the screen, it will handle the event accordingly for that particular thumbnail underneath. I would like to know if it is a good/possible approach?
It would be a hell of a lot easier to use a UICollectionView.
If you need a custom layout then you can subclass UICollectionViewLayout and get some really cool dynamic layouts.
You also get the added bonus of dequeued cells meaning that you get better memory management using it.
You may find UIGestureRecognizer useful. A good tutorial to get you started is here.

Google play like slider for ios?

Im trying to create a uiview horizontal touch slider. Similar to how the google page store is designed on android. I was thinking i would just put a bunch of uiviews (as pages) inside a single huge uiview and just drag the uiview along on touchevent. But i also need to detech which is the active view to perform post requests and itd need to loop. Any suggestions? Tutorials?
I think the appropriate answer for your question would be "Horizontal UITableView". Checkout these code shared on GitHub.
EasyTableView
Another Example for Horizontal Table View
You can design cells as per your need to show. Also you will get each active cell when you click it in didSelectRow.
Hope it works for you.

How to draw in code an imageview

I have a problem. I want for each record in my core data database to draw an UIImage view on screen. But the problem is that I want to make a sort of grid. On the link below you see what I want to achieve.
picture
So my question is, how do I draw an image on screen in code. And place those images in a sort of a grid. using a collection view is no option, because the app should be running on all IOS devices.
While you could implement a custom UIView and implement the drawRect: method and draw UIImages there, I suggest just using multiple UIImageViews as subviews on your "main" view. Your view might be embedded in a UIScrollView, or you could use a UITableView with custom UITableViewCells. Whichever is easier is probably related to how you can interact with the view.
Building that one huge image view is something that I'd definitely try to avoid - it costs many many (probably unnecessary) memory, and it might be slow as well. Definitely not very flexible to handle, and a pain to update dynamically.
A quick cheat for something like this is to use a Table View and then in each cell to place another TableView but rotated at 90 degrees.
You can then use this second TableView to display the pictures etc...
This will give you a table that scrolls up and down and then each cell can scroll left to right.
I'd suggest subclassing UITableViewCell and setting it up as a UITableViewDelegate and UITableViewDatasource.
You will also have to remember to rotate the content of these "sub"tables by 90 degrees also so that they are the right way up.
This sounds like a lot of work but if you push the management of the sub Tables into the cells then it actually becomes quite easy.

Grid View with UIPageControl in iOS 5?

I know there are plenty of Grid Views out there for iOS and Objective-c, but I couldn't find one that fits me. Currently I use a grid view called UIGridView. It included only two files and was very simple to implement. However it cannot have more cells than it can fit on the screen. I want a dynamic grid view where I can have a UIPageControl to have multiple pages with cells. I like the UITableView but for this project it would be more efficient to have a grid view.
I currently use this grid view: http://www.chupamobile.com/products/details/380/Interactive+Grid+View/
Is there a simple grid view with page control? Or can I put my current grid view in in a UIPageControl?
Did you try CHGridView at https://github.com/camh/CHGridView ?
I settled with the MMGridView. It has horizontal page control scrolling. I just modified the cells to my liking. You can find the git source here: https://github.com/provideal/MMGridView
I am currently using AQGridView so surely i recommend that as it is the least buggy and its functions are very similar to UITableView.
Also that If you are trying to do this without XIB it will be little bit difficult for you to handle it but you can create a view controller with Xib file to Create the interface of your choice. Here is the Video of how it can be done in the best possible way by Evadne Wu. And here is the Sample Project
Now for the Paging Control
in AQGridView you just need to set Paging Enabled and it will automatically do the rest. Hope that helps.

How to control the Appearance of UIPickerView

Can anyone point me in the right direction here.
Im trying to use a UIPickerView that is displaying images.
The images are too big for the default pickerview setup so I was wondering how I could control how big the rows in the UIPickerView are and how wide the translucent selection bar is to accomodate for their custom size.
Can anyone provide some guidelines as to how big I should make the row images or where a good tutorial / book chapter is on this?
Thanks!
Why not use the UIImagePickerController instead of trying to customize a UIPickerView? It is designed to enable you to allow the user to pick from their library of images if you use the sourceType of UIImagePickerControllerSourceTypePhotoLibrary.
There is sample code on how to use this controller at http://zcentric.com/2008/08/28/using-a-uiimagepickercontroller/
If the images are not from the user's library, then I would suggest you scale the images down to fit the constraints of the UIPickerView, or use a tabelView with the images laid out in it for the user to select.