开发者

xcode picker output into array

开发者 https://www.devze.com 2023-04-04 14:09 出处:网络
I have table cell view with which each cell must represent the output of a picker selection by the user.

I have table cell view with which each cell must represent the output of a picker selection by the user.

The table cell view has two labels and a button. The button is to call up the picker of course.(little right arrow)

The first label i need to return the number of the cell row?

The second label needs to return the picker selection of the user.

This is what i have in my picker implementation method file for the button upon picker selection by the user:

    -(IBAction)buttonPressed
    {
NSInteger suitRow = [doublePicker selectedRowInComponent:
                      kSuitComponent];
NSInteger numberRow = [doublePicker selectedRowInComponent:
                        kNumberComponent];
NSString *suit = [suitTypes objectAtIndex:suitRow];
NSString *number = [numberTypes objectAtIndex:numberRow];

    This is where i need to put suit and number into array?
    i also want to re开发者_StackOverflow社区turn the row number?
}

So i need to save those two values and return them to my other view?


Presumably the object in your array is already created since you are editing an existing row. So you should pass this object to your picker view controller, and edit it in the action above. When you return to the table view you may need to call reloadData

It may be worth looking at editing your cells in the same view, using the picker as the editing view of the field(s) in your cell. This would keep everything on the same controller and simplify your code as you'd know which item you were editing.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号