0

I'm new to ios, and I've already got my design ready, now I don't know is there a best practice for me to do the following thing:

I have 1000 cards, each of it is like this:

enter image description here

And when I slide right, it will get the next one, I slide left it will back to the previous one

I can implement this now, but I can only implement this one by one for 1000 times.

In addition, when I click the middle of the card, it will flip horizontally, then show the translation. it's the second kind of card with different language and color.

So is there any hint for me? any loop can do it?

update

About data-drive, so I thought about database, and I search the google that there's four way of persistence in ios,

I decide to choose sqlite, is it a wise choice?

Reason:

  1. I'm familiar with mysql, and use sqlite in rails before

  2. sqlite is not too big.

  3. I need to save original sentence, translate sentence, saved or not flag, additional story.

daniel-xu
  • 25
  • 7
  • How are you implementing this so far? Have you created views in a storyboard for each of your cards? – Paulw11 May 21 '14 at 03:30
  • Actually, I haven't implemented all of these, I just create view for it. And I don't want to do the same things for 1000 times – daniel-xu May 21 '14 at 03:31
  • Ok, so with that approach you end up with 1000 views and it will be painful. It will be easier if you can shift to a data-driven approach but you need to be able represent each card in a database of some sort - it is hard to say exactly how because you only have a single example of a card, but lets say all that changed was the text. One approach You would be load your 1000 different bits of text into an array then keep track of which card you are currently displaying. Use a scroll view and as you begin to scroll left and right render the next/prev card and add it to the view – Paulw11 May 21 '14 at 03:34
  • The answers to this question on circular scrolling may help -http://stackoverflow.com/questions/10448081/uiscrollview-with-circular-scrolling – Paulw11 May 21 '14 at 03:35
  • @Paulw11 Thank you very much, I kinda get what you said, I have web development experience, so I will definitely check it out! – daniel-xu May 21 '14 at 03:40
  • http://stackoverflow.com/a/3421382/189804 – Adam Eberbach May 21 '14 at 04:07

0 Answers0