开发者

Creating a checkmark inside a Pickerview [duplicate]

This question already has answers here: How can I get a check mark beside UIPickerView labels? 开发者_高级运维 (2 answers) Closed 9 years ago.

I am developing an application where i want to create a checkmark on the selected row by the user.

For Ex.

Creating a checkmark inside a Pickerview [duplicate]

In UITableView there is UITableViewCellAccessoryCheckmark;

But i am wondering is there something similar available for UIPickerView.

Any tutorial or pointer to get this behaviour?


I've made a UIPickerView subclass which can be used to implement this functionality. It forwards touch events to its superview and can therefore suppress the default behavior where entries are selected as they scroll past the middle.

The checkmark can be implemented by, as pertert writes, creating a custom UIView with an UIImageView and a UILabel for the pickerview's entries via the delegate method:

- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view

You can find the project containing my subclass on Github.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜