I have a UIPickerView that pops up from the bottom of the IPhone's screen when a UITextField begins editing. When a row is selected my UIPickerView is dismissed.
But the problem is that don't manage to select the first row which is shown under the selection indicator.
Right now I can select all except the first row. So the UIPickerView never dismisses and I can't choose that value.
The only workaround I found is to scroll a bit the picker in order to still select the first row, so when I "release the touch" the first row is selected. But it's not a good workaround I need the same behavior I have with the other rows.
Thanks for your help as usual.
Wallou
Bye
The way many apps do the trick is to add a button upon the picker to validate the selected item.
Related
I'd like to create a custom UIPickerView in iOS that will present the elements of the picker to the user, but have a "blank" selection at the top. If the user doesn't select anything then the result from the UIPickerView is nil. If the user scrolls down to select something, then it just returns to proper index in the list.
The problem with the UIPickerView is that when you come into it, it looks like the user has at least selected the first element.
I would like to "force" the user to pick something.
Thanks for your help.
can't you just make the first item in the datasource a #""?
I have a scrollview which has several table views as sub views...
say that I have selected a cell in one of the sub views. Now when I select a cell from another view, the cell I selected previously should not be highlighted.
How do I do this? I know I can do this using the first responder, but I am not sure how to do it.
Would anyone be able to help me out in this?
Thanks
From the apple interface guidlines:
Always provide feedback when users select a list item. Users expect a table row to highlight briefly when they tap a selectable item in it. After tapping, users expect an immediate action to occur: Either a new view appears or the row displays a checkmark to indicate that the item has been selected or enabled.
In rare cases, a row might remain highlighted when secondary details or controls related to the row item are displayed in the same screen. However, this is not encouraged because it is difficult to display simultaneously a list of choices, a selected item, and related details or controls without creating an uncomfortably crowded layout.
I don't think apple will approve an app that leaves a row highlighted (I had an app reject for that very reason). You should perform an action and then immediately unhighlight it. In some rare cases you can leave it highlighted while showing a related view.
However, if you store the current cell you have selected, you can call -deselectRowAtIndexPath:animated: on the tableview to deselect a row.
My table view is set up such that pressing "edit" creates an insert row using UITableViewCellEditingStyleInsert. The cell reads "add new item" and has a green plus next to it.
When the user taps the green plus, a modal view controller pops up so they can add a new item. This is fine. But it only works if they press the green plus itself - not the "add new item" cell.
How can I make it so that pressing the cell itself will do the same as the green plus?
Thanks!
You can; you just have to handle the selection yourself. First set allowsSelectionDuringEditing = YES, as shown above, then in the delegate's didSelectRowAtIndexPath: method, check to see if the selected row is the last row (or whatever row has your plus icon). If it is, run the same code you do in the didCommitEditingStyle: method.
I think ,Not possible because the entire edit mode process of UITableView is controlled by iOS (done by private API's) not exposed to us. we do have delegated (UITableViewDelegate) functions but not sufficient to get your work done.
Although, we can show the selection on the table Cell while in edit mode.
#property(nonatomic) BOOL allowsSelectionDuringEditing
http://developer.apple.com/library/ios/#documentation/uikit/reference/UITableView_Class/Reference/Reference.html
I have a UIPickerView with two components.
It works fine when the user scrolls each component until it reaches the desired value.
But I want it to behave like the picker in the calendar or the clock apps. Meaning: When the user presses a certain value in one of the components, I want that component to automatically turn that row to be the selected row (so the user doesn't always have to scroll, he/she can also simply select the value they want).
Does anyone know how to do that?
Thank you,
~Chonch
It is standard picker behaviour and it should work so automatically.
If your picker does not select tapped row automatically try to set userInteractionEnabled property to NO for the view you return from viewForRow: method in picker data source.
I have a list of things in a table view.
When a user tap a row, I increase score. I wish provide a way to clear the score for that row.
My first try is put the table in edit mode, show the delete button to that row and proceed. However, all the other rows get blocked and can't tap again the score or tap in the disclosure button.
So, obviously this is not the way. But then I don't see what to do. Any suggestion?
You could add a button to clear the row’s score as a subview of your table cell. I suppose you’d have to put it on the left side, though, since the disclosure button is on the right.