using System; using System.Collections.Generic; using System.Linq; using System.Text; using UIKit; using Foundation; using Shared.IO; using CoreGraphics; namespace Shared { /// /// Button 按键 /// public class DateView : View { MyUIDatePicker myUIDatePicker { get { return uiView as MyUIDatePicker; } set { uiView = value; } } /// /// 年 /// public int Year { get { return (int)myUIDatePicker.current.Year; } } /// /// 月 /// public int Month { get { return (int)myUIDatePicker.current.Month; } } /// /// 天 /// public int Day { get { return (int)myUIDatePicker.current.Day; } } /// /// Initializes a new instance of the class. /// public DateView() { myUIDatePicker = new MyUIDatePicker(this); } class MyUIDatePicker : UIDatePicker { View _view; public MyUIDatePicker(View view) { Mode = UIDatePickerMode.Date; _view = view; } /// /// 点击开始 /// /// Touches. /// Evt. public override void TouchesBegan(NSSet touches, UIEvent evt) { //base.TouchesBegan(touches, evt); var touch = touches.AnyObject as UITouch; _view.TouchEvent(EventActions.Down, touch.LocationInView(this)); //1109492162 } /// /// 移动 /// /// Touches. /// Evt. public override void TouchesMoved(NSSet touches, UIEvent evt) { //base.TouchesMoved(touches, evt); var touch = touches.AnyObject as UITouch; _view.TouchEvent(EventActions.Move, touch.LocationInView(this)); } /// /// 点击弹起 /// /// Touches. /// Evt. public override void TouchesEnded(NSSet touches, UIEvent evt) { //base.TouchesEnded(touches, evt); var touch = touches.AnyObject as UITouch; _view.TouchEvent(EventActions.Up, touch.LocationInView(this)); } /// /// 当前时间对象 /// /// The current. public NSDateComponents current { get { NSCalendar cal = NSCalendar.CurrentCalendar; return cal.Components(NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day, Date);// [cal components: unitFlags fromDate: now] } } } } }