using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CoreGraphics;
using Foundation;
using UIKit;
namespace Shared
{
///
/// 时间视图
///
public class TimeView : View
{
///
/// 当前视图
///
/// The android text.
MyUITimePicker currentUITimePicker
{
get
{
return uiView as MyUITimePicker;
}
set
{
uiView = value;
}
}
///
/// 时
///
public int Hour
{
get { return (int)currentUITimePicker.current.Hour; }
}
///
/// 分
///
public int Minute
{
get { return (int)currentUITimePicker.current.Minute; }
}
///
/// 视图
///
public TimeView()
{
currentUITimePicker = new MyUITimePicker(this);
}
class MyUITimePicker : UIDatePicker
{
View _view;
public MyUITimePicker(View view)
{
Mode = UIDatePickerMode.Time;
_view = view;
}
nfloat x;
///
/// 点击开始
///
/// Touches.
/// Evt.
public override void TouchesBegan(NSSet touches, UIEvent evt)
{
//base.TouchesBegan(touches, evt);
UITouch 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);
UITouch 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);
UITouch touch = touches.AnyObject as UITouch;
_view.TouchEvent(EventActions.Up, touch.LocationInView(this));
}
public NSDateComponents current
{
get
{
NSCalendar cal = NSCalendar.CurrentCalendar;
return cal.Components(NSCalendarUnit.Hour | NSCalendarUnit.Minute | NSCalendarUnit.Second, Date);// [cal components: unitFlags fromDate: now
}
}
}
}
}