xamarin ios UIPickerView
2015-09-21 12:24
316 查看
private void SetupPayoutsPicker()
{
List<string> payouts = new List<string> ();
for (int i = 1; i < 201; i++) {
payouts.Add (i.ToString ());
}
PickerModel model = new PickerModel (payouts);
if (payouts != null && payouts.Count != 0) {
getPayout = payouts [0];
}
model.PickerChanged += (sender, e) => {
getPayout=e;
};
UIPickerView picker = new UIPickerView ();
picker.ShowSelectionIndicator = true;
picker.Model = model;
UIToolbar toolbar = new UIToolbar ();
toolbar.BarStyle = UIBarStyle.Black;
toolbar.Translucent = true;
toolbar.SizeToFit ();
UIBarButtonItem doneButton = new UIBarButtonItem ("Done", UIBarButtonItemStyle.Done,
(s, e) => {
txtPayouts.Text=getPayout;
txtPayouts.ResignFirstResponder();
});
toolbar.SetItems(new UIBarButtonItem[]{doneButton}, true);
txtPayouts.InputView = picker;
txtPayouts.InputAccessoryView = toolbar;
}
{
List<string> payouts = new List<string> ();
for (int i = 1; i < 201; i++) {
payouts.Add (i.ToString ());
}
PickerModel model = new PickerModel (payouts);
if (payouts != null && payouts.Count != 0) {
getPayout = payouts [0];
}
model.PickerChanged += (sender, e) => {
getPayout=e;
};
UIPickerView picker = new UIPickerView ();
picker.ShowSelectionIndicator = true;
picker.Model = model;
UIToolbar toolbar = new UIToolbar ();
toolbar.BarStyle = UIBarStyle.Black;
toolbar.Translucent = true;
toolbar.SizeToFit ();
UIBarButtonItem doneButton = new UIBarButtonItem ("Done", UIBarButtonItemStyle.Done,
(s, e) => {
txtPayouts.Text=getPayout;
txtPayouts.ResignFirstResponder();
});
toolbar.SetItems(new UIBarButtonItem[]{doneButton}, true);
txtPayouts.InputView = picker;
txtPayouts.InputAccessoryView = toolbar;
}
相关文章推荐
- 峰回路转,Firefox 浏览器即将重返 iOS 平台
- 峰回路转,Firefox 浏览器即将重返 iOS 平台
- 不可修补的 iOS 漏洞可能导致 iPhone 4s 到 iPhone X 永久越狱
- iOS 12.4 系统遭黑客破解,漏洞危及数百万用户
- c#调用COM组件
- 每日安全资讯:NSO,一家专业入侵 iPhone 的神秘公司
- [转][源代码]Comex公布JailbreakMe 3.0源代码
- C#实现把指定数据写入串口
- C#动态创建button的方法
- C#中抽象方法与虚拟方法的区别
- c#中虚函数的相关使用方法
- C#使用加边法计算行列式的值
- C#实现多线程的同步方法实例分析
- C#中尾递归的使用、优化及编译器优化
- C#实现子窗体与父窗体通信方法实例总结
- C#通用邮件发送类分享
- C#中this的用法集锦
- C#.NET获取拨号连接的宽带连接方法
- C#异步绑定数据实现方法