Home Ask Login Register

Developers Planet

Your answer is one click away!

Nathan McKaskle February 2016

Swift 2.1 Selecting Options from Image Icons in a View Controller

If I wanted to have a screen with a number of options displayed via icons to present to the user to select from. What would be the best way to do this?

For instance if I had 6 different images with varying price ranges like $25 - $35, $35 - 50, $50 - $75 and so on and I wanted them to select one of these ranges, what would one suggest I use in this situation? A tableview? A collectionview? Is there a way to use a collectionview in this manner?


Crazy Developer February 2016

It is totally depend on your app requirement and UI. you can use tableview, collectionView, or scrollview.

you just need to manage the selection of the item. For that you should use NSArray of NSDictionary. Where NSDictionary having a key called selected which is set to true when item get selected. When any other object get selected you make a loop which make all object selected to false. and then set the selected object to true.

Post Status

Asked in February 2016
Viewed 1,908 times
Voted 12
Answered 1 times


Leave an answer

Quote of the day: live life