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.
Related
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.
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.
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.
I am relatively new to Objective-C and iOS development.
What I want to do is have it that I have an array of length 52 representing a deck of cards, with each value in the array corresponding to a card image. When a button is pressed, the card that comes out will appear in an image view (already done), as well as appear as the right most element in a horizontal scroll view.
I do not however know how to do this in Objective-C, neither the horizontal view nor the appending to the end (or right).
Any help will be much appreciated,
Thank you very much for your time.
AB
What you're looking to do is called Paging with a UIScrollView. Download the "Page Control" Sample project by apple here :
http://developer.apple.com/library/ios/#samplecode/PageControl/Introduction/Intro.html#//apple_ref/doc/uid/DTS40007795
Think of each page in that project as another card. You can add/subtract from it whilst the program is running. You can take a look at my open source "Dollar Bets" app on github for another example here:
https://github.com/Rich86man/Dollar-Bets
Check out MainViewController
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.