Search code examples
iphoneobjective-ciosxcodexcode4

Looking for a Better Solution, Possibly Page Control?


I am building an iPad app that will use multitouch gestures (Left and Right). I have a Plist that will have different categories like Apple, Orange, Banana, and so on. That Plist will change as time goes on.

What is the best technique for changing the labels and strings that will be pulled out of the Plist. As an example, I would like to be on the Orange selection, and then swipe left to Apple and Then Swipe right back to Orange.

Should I use a Page Control? I am currently using If statements to change the text from the Plist, Im just looking for a better solution.


Solution

  • Ya you can use the page control and for changing the text from the plist. you can do like save the data form the plist in an array.

    for ex: you have apple,orange,grapes,guava in your plist

    save them in your array i.e apple will be on index 0, orange on index 1 etc.

    declare a flag that will keep a track of your movements i.e either left or right.

    suppose you are on orange page so your flag will be 1(i.e the index value of orange)

    if you move left reduce the flag by 1 or move right, then increase the flag by 1 and fetch the objectAtIndex:flag from the array. this way you will have the required data from the plist and you can easily update your text w.r.t your plist.