Table as 'option list' under IOS5 - objective-c

I make some UI under IOS5 that enables to select 1 item from some 5 items.
As a beginner in this platform I am looking for the best solution. First I thought to create a list view which's items can be checked. I could make it, but idi not find a solution 'out of the box' that checks one item by clicking and uncheck all others. Is it the normal way to implement it by code? Or does listview have some kind of 'check-the-clicked-cell-and-uncheck-others' property/method?
I know I can use also picker view as an option selector but I prefer checkable table this time.
Thanks!

There is no out-of-the-box uITableView solution. You would have to handle unchecking the other table view cells programmatically by adding some code to tableView:didSelectRowAtIndexPath:.

Related

Implementing Swipe Animation like Pivot Page in PhoneApplicationPage windows phone 8

I am having a lot of Items(Say 100), I want the user to swipe right and left to see the detailed description of Items.
I thought of using a Pivot Control, but that is causing performance problem because of too many items.
Now, In order to make it lightweight, I want to implement the scenario in a Single page and change the DataContext when the user swipes. I know that swipe gestures can be detected from the toolkit project. Now, I want to animate my grid, when swipe gestures happening exactly like Pivot Page or a Normal Scroll behaviour. I searched a bit, and found that it can be done by creating StoryBoard animation but I am less experienced in that. Any code sample will be helpful. Thanks.
i think you can make archive page and when the user select the item jump to the pivot with selected index
Small possible code sample.
In your page code behand, initialize a Dictionary ( where int is the position and pivotitem the pivot )
Load it up with 3 pivots at start
Than if your Pivot control is called AllPivots, do AllPivots.Items.Add(pivotItem) for each pivot inside the dictionary.
Next thing to do is detect how the user is changing the pivots, so if the selectedindex changes of AllPivots, see if the user advances, if so, add the next pivot into the dictionary and also to the AllPivots.Items and remove the first pivot with AllPivots.Items.Remove.
Each time the user goes back or forward look up the next or previous pivot in the dictionay and perform the correct actions or create new pivots on the fly.
Like I said a dirty hack, but maybe worth a try

Adding drag and drop functionality to metro style app buttons with C# and XAML

I'm trying to implement a sort of drag functionality into my app. As a simplistic example imagine I have a 2x2 square of buttons, so four buttons total. Clicking a button will perform some other functionality however I want when they hold and drag one of these buttons for it to do something else (ideally if you drag one button and drop it while in the space of another button the two buttons will swap places, as long as I can get dragging and dropping working the swap should be easy).
I've done some research and followed a few tutorials but seemed to get errors at one step or another with all of those. It seems ListViews and GridViews have some drag and drop functionality in them already , but I had trouble properly arranging my buttons (there are many more than four and they are in very specific positions, like a diagram) inside these views, let alone getting drag and drop working with them.
How would I go about doing this? Ideally I could just tag these buttons as draggable, and then on a drag-drop event check for a drop position, then if the position is valid perform a swap method. I just can't seem to figure out how to make them draggable or how to have an event that checks a drop position.
Thanks.
Easy peasy, create a custom control that looks the way you want it to, set ManipulationMode to TranslateX|TranslateY, handle manipulation delta events to update positioning with something like a Canvas or TranslateTransform and when manipulation completes - either make it click or animate to the new position. From my experience - getting any other manipulations to work with a regular Button class just isn't working and since a button is a really simple control - it is easier to create your own than try to extend the existing one in such cases.

Which control can be used in order to display a dynamic form (with various types of data)?

I'm facing the following problems:
We have meta data for items, each item can be a different type of NSControl, currently NSTokenField and NSTextField, but we might need NSCombo or other types.
I need to build a form in which each entry will have a label and an editable control.
this form has to be built dynamically since the items are retrieved from the server.
I've implemented it with NSMatrix, and apart from it looking pretty shabby, I'm faced with some visual issues I don't know how to solve.
The visual issue is every time I move the mouse over the NSTextFieldCell the tokens get drawn on the top left corner of the NSMatrix form.
now, I'm considering moving to another type of control,
I've googled for few hours, and found the following controls:
NSForm,
NSMatirx (parent of NSForm),
NSCollectionView,
NSTableView
which one of these is the most appropriate for this task?
I hope I am clear since I wanted to add pictures, but it wouldn't let me due to lack of "reputation points".
Thanks for your help,
Eyal.
NSTokenField is a subclass of NSTextField so you could use an NSTableView to display them.
You could also draw a custom NSCell with all elements in it. When each "item" has a different number of elements then this becomes a bit more complicated though.

Creating custom combination of widget in Cocoa

I have seen that in Cocoa I can create a custom view using drawing primitives which allows me to draw what I like but at a very low level.
Instead I'd like to create custom widgets using a combination of existing controls. For example:
I'd like to create a table with images and combobox in cells
I'd like to create a custom widget wich is a combination of several (for example a list, a button and combobox)
How can I approach this problem ?
Secondly a typical cocoa developer uses external controls? Is there a repository or a list of interesting external custom controls (commercial or free) ?
I'd like to create a table with images and combobox in cells
There already exists NSImageCell and NSComboBoxCell. Are you sure you need to do anything different?
If the problem is that you want an image and a combo box in the same cell, you will have to subclass NSCell. Currently table views can only contain cells, not views, which makes your life harder (as understanding how cell drawing works is more difficult). That will change in Lion, however, so if you can wait until then, this will become easier!
I'd like to create a custom widget wich is a combination of several (for example a list, a button and combobox)
How is your custom widget different to just placing those three things in the same view?
You could write your own NSView subclass. When it's created, it should create a list, a button and a combobox and add them as subviews to itself. Your NSView subclass should handle the logic of keeping them in sync or doing whatever it is you want them to do. Then, to use this combination control in Interface Builder, you place a Custom View and set its class (rightmost tab of the inspector) to your NSView subclass.
BTW, on a tangent, are you sure you mean combobox? Loads of people coming from Windows get this one wrong. A combobox is a combination of a menu and a text field: it allows the user to enter custom text that is not in the menu. If you just want a dropdown menu of choices (and the user can't enter a custom one), you use an NSPopupButton.
Secondly a typical cocoa developer uses external controls?
Yes, sometimes. Things like BWToolkit can be very useful. There's a lot more that are just floating around mailing lists as code snippets, rather than being cleaned up and put in a library. Search for what you need to do!

Creating a drop down list

I want to make a drop-down list from scratch. Can anyone please tell me how to do so?
You would start with a UITextField and a button to look like a normal closed drop down list. Then when the button is clicked I would add a new view containing a small UITableView for the drop down part. It shouldn't be too hard. However I'd reconsider the need for a drop down box. Its just not something that you have room on screen for, and the UIPickerView is better suited IMHO. Now on the iPad they use a drop down similar to what I described above but it has enough room on the screen to make this practical.
You can use a UIPickerView or a UITableView to have a functionality akin to drop down lists.