1// 、按钮 UIButton
UIButton btn = new UIButton();
btn.Frame = new RectangleF(,,,); //按钮位置一件宽高
btn.SetTitle("Button",UIControlState.Normal); //显示的文字
btn.SetTitleColor(UIColor.Black,UIControlState.Normal);//文字的颜色
btn.TouchUpInside += this.SetBackGroudColor; //按钮 触摸事件
this.View.AddSubview(btn); //添加到当前视图 //、图像视图 UIImageView
UIImageView img=new UIImageView();
img.Frame = new RectangleF(,,,); //设置位置大小
img.ContentMode = UIViewContentMode.ScaleAspectFit; //设置图像视图模式
img.Image = UIImage.FromFile("img.jpg"); //设置图像
img.Transform = CGAffineTransform.MakeRotation();//图像旋转正数顺时针旋转,负数逆时针旋转
img.Transform = CGAffineTransform.MakeScale(-,); //图像缩放
this.View.AddSubview(img); //添加到当前视图 //、label控件 UILabel
UILabel lbl1 = new UILabel();
lbl1.Frame = new RectangleF(,,,);
lbl1.Text = "UILabel";
lbl1.Lines = ; //显示行数 配合 label高度 使用
lbl1.LineBreakMode = UILineBreakMode.MiddleTruncation; //内容显示样式
lbl1.Hidden = true; //是否显示
this.View.AddSubview(lbl1); //、输入框 UITextField
UITextField t1 = new UITextField();
t1.BorderStyle = UITextBorderStyle.RoundedRect;
t1.Frame = new RectangleF(,,,);
t1.Placeholder = "账号";
// 限制输入字符长度
t1.ShouldChangeCharacters = (textField, range, replacementString) => {
if (range.Location < )
return true;
else
return false;
};
this.View.AddSubview(t1);
UITextField t2 = new UITextField();
t2.BorderStyle = UITextBorderStyle.RoundedRect;//边框样式
t2.Frame = new RectangleF(, , , );
t2.Placeholder = "密码";
t2.SecureTextEntry = true; //隐藏文本
this.View.AddSubview(t2); UITextView text = new UITextView();
text.Frame = new RectangleF(, , , ); this.View.AddSubview(text);
//、UITextView 实现功能:点击完成按钮隐藏键盘,并且把text的Text值赋值给text1控件,并监控 text控件的状态(开始输入,结束输入,输入中)
UITextView text1 = new UITextView();
text1.Frame = new RectangleF(, , , );
text1.Editable = false;
this.View.AddSubview(text1);
text1.Hidden = true;
UIButton btn = new UIButton();
btn.Frame = new RectangleF(,,,);
btn.SetTitle("完成", UIControlState.Normal);
btn.SetTitleColor(UIColor.Red,UIControlState.Normal);
this.View.AddSubview(btn);
btn.TouchUpInside += (sender, e) => {
text.ResignFirstResponder();
text1.Hidden=false;
text1.Text = text.Text; };
text.Delegate = new MyDelegate(); }
private class MyDelegate : UITextViewDelegate
{
public override void EditingEnded(UITextView textView)
{
Console.WriteLine("Edit end");
}
public override void EditingStarted(UITextView textView)
{
Console.WriteLine("Edit start");
}
public override void Changed(UITextView textView)
{
Console.WriteLine("Edit ");
}
}
//、 输入框键盘 样式类型 设置
UITextField fied = new UITextField();
fied.Frame = new RectangleF(, , , );
fied.BorderStyle = UITextBorderStyle.Line;
this.View.AddSubview(fied);
fied.KeyboardType = UIKeyboardType.Url;//设置键盘类型
fied.KeyboardAppearance = UIKeyboardAppearance.Dark;// 设置键盘外观
fied.ReturnKeyType = UIReturnKeyType.Next;//设置键盘的Return键 96// 、显示键盘 时改变输入框的位置
UITextField fied = new UITextField();
private NSObject kbdWillShow, kbdDidHide; public override void ViewDidLoad()
{
base.ViewDidLoad();
fied.Frame = new RectangleF(, , , );
fied.BorderStyle = UITextBorderStyle.RoundedRect;
this.View.AddSubview(fied);
//显示键盘前 (事件)
kbdWillShow = UIKeyboard.Notifications.ObserveWillShow((s, e) => {
RectangleF kbdRounds = (RectangleF)e.FrameEnd;
RectangleF textFrame = (RectangleF)fied.Frame;
textFrame.Y -= kbdRounds.Height;
fied.Frame = textFrame;
});
//隐藏键盘后 (事件)
kbdDidHide = UIKeyboard.Notifications.ObserveDidHide((s, e) =>
{
RectangleF kbdRounds = (RectangleF)e.FrameEnd;
RectangleF textFrame = (RectangleF)fied.Frame;
textFrame.Y += kbdRounds.Height;
fied.Frame = textFrame;
});
//键盘上的return键 隐藏键盘 (事件)
fied.ShouldReturn=delegate(UITextField textField) {
return textField.ResignFirstResponder();
};
}
//、 为输入框键盘 添加工具栏
UITextField fied = new UITextField();
fied.Frame = new RectangleF(, , , );
fied.BorderStyle = UITextBorderStyle.RoundedRect;//设置输入框边框
this.View.AddSubview(fied);
fied.KeyboardType = UIKeyboardType.EmailAddress;//设置键盘类型
//设施工具栏
UIToolbar bar = new UIToolbar();//实例化工具栏
bar.SizeToFit();
bar.BackgroundColor = UIColor.DarkGray;//设置背景
//实例化 工具栏 按钮
UIBarButtonItem item = new UIBarButtonItem("完成", UIBarButtonItemStyle.Done, (s, e) =>
{
//隐藏键盘
fied.ResignFirstResponder();
});
//为工具栏设置条目
bar.SetItems(new UIBarButtonItem[]{ item},true);
//为输入框 键盘添加工具栏
fied.InputAccessoryView = bar; //、文本视图菜单 退出按钮
public override void ViewDidLoad()
{
tf.Frame = new RectangleF(,,,);
this.View.AddSubview(tf);
UIMenuItem item = new UIMenuItem("退出", new Selector("hide"));//添加菜单按钮 UIMenuController c = UIMenuController.SharedMenuController;
c.MenuItems = new UIMenuItem[] { item }; }
UITextView tf = new UITextView();
[Export("hide")]
public void hide() {
//退出键盘
tf.ResignFirstResponder();
} //、触摸背景隐藏键盘
public override void ViewDidLoad()
{
tf.Frame = new RectangleF(,,,);
tf.BorderStyle = UITextBorderStyle.RoundedRect;
this.View.AddSubview(tf); }
/// <summary>
///重写 ViewController 方法 TouchesBegan
/// </summary>
/// <param name="touches">Touches.</param>
/// <param name="evt">Evt.</param>
public override void TouchesBegan(NSSet touches, UIEvent evt)
{
tf.ResignFirstResponder();
}
182// 、进度条控件 UIProgressView 先在添加一个lable lbl 和一个button sta
public override void ViewDidLoad()
{
//按钮的触摸事件
sta.TouchUpInside+=delegate {
sta.Enabled = false;
pv.Progress = 0f;
//创建一个新的任务 用来计算 进度条的值 并更新视图
Task.Factory.StartNew(this.Start);
};
/创建进度条 并添加到视图
pv = new UIProgressView(new RectangleF(60f,200f,200f,50f));
pv.Progress = 0f;
f = 1f / 10f;
this.View.AddSubview(pv);
}
UIProgressView pv;
float f = 0f;
public void Start() {
float p = 0f;
while (p<1f) {
Thread.Sleep();
//调用主线程 修改视图
this.InvokeOnMainThread(delegate {
pv.Progress += this.f;
p = pv.Progress;
lbl.Text = Math.Round(pv.Progress, ).ToString();
if (p >= 1f)
{
lbl.Text = "加载完成!";
sta.Enabled = true;
}
});
} }
218// 、滚动视图
().
UIImageView img;
UIScrollView scr;
public override void ViewDidLoad()
{
base.ViewDidLoad();
img = new UIImageView(UIImage.FromFile("1.png"));
scr = new UIScrollView();
scr.Frame = new RectangleF(,,,);
scr.ContentSize = img.Image.Size; //滚动范围
scr.ContentOffset = new PointF(200f,50f); //目前滚动位置
scr.PagingEnabled = true; //可以整页翻动
scr.MinimumZoomScale=0.25f; //缩放最小比例
scr.MaximumZoomScale=2f; //放大的最大比例
//获取要缩放的图像视图
scr.ViewForZoomingInScrollView=delegate (UIScrollView scrll){
return this.img;
};
scr.ZoomScale = 1f; //设置变化比例
scr.IndicatorStyle = UIScrollViewIndicatorStyle.Black; //滚动指示器的风格设置
scr.AddSubview(img);
this.View.AddSubview(scr);
}
().
UIScrollView scr = new UIScrollView();
scr.Frame = new RectangleF(,,,);
scr.ContentSize = new SizeF(,);
this.View.AddSubview(scr);
//滚动视图开始时调用
scr.Scrolled+=delegate {
Console.WriteLine("Start rolling");
};
//滚动视图结束时调用
scr.DecelerationEnded+=delegate {
Console.WriteLine("Start End");
};
float y = ;
for (float i = ; i < ; i++) {
UILabel lab = new UILabel();
lab.Frame = new RectangleF(,y,,);
lab.BackgroundColor = UIColor.Cyan;
lab.Text = String.Format("{0}",i);
scr.AddSubview(lab);
y += ; }
265// 、页面控件
UIImageView img1;
UIImageView img2;
UIImageView img3;
UIScrollView scr;
UIPageControl pagc;
public override void ViewDidLoad()
{
base.ViewDidLoad();
//添加滚动视图
scr = new UIScrollView();
scr.Frame = new RectangleF(,,,);
//滚动视图结束滚动时调用
scr.DecelerationEnded += this.scr_DecelerationEnded;
//添加页面
pagc = new UIPageControl();
pagc.Frame = new RectangleF(,,,);
pagc.Pages = ; //设置页面数值 及页面小白点
//当页面数值发生改变时调用
pagc.ValueChanged += this.pagc_ValueChanged;
//滚动视图的滚动事件
scr.Scrolled+=delegate {
Console.WriteLine("Scolled!");
};
scr.PagingEnabled = true;
RectangleF rf = (RectangleF)scr.Frame;
scr.ContentSize = new SizeF(rf.Width*,rf.Height);
//添加图像视图
img1 = new UIImageView();
img1.ContentMode = UIViewContentMode.ScaleAspectFit;
img1.Image = UIImage.FromFile("1.jpg");
rf.X += (float)this.scr.Frame.Width;
img2 = new UIImageView();
img2.ContentMode = UIViewContentMode.ScaleAspectFit;
img2.Image = UIImage.FromFile("2.jpg");
rf.X += (float)this.scr.Frame.Width;
img3 = new UIImageView();
img3.ContentMode = UIViewContentMode.ScaleAspectFit;
img3.Image = UIImage.FromFile("3.jpg");
rf.X += (float)this.scr.Frame.Width; scr.AddSubview(img1);
scr.AddSubview(img2);
scr.AddSubview(img3);
this.View.AddSubview(scr);
this.View.AddSubview(pagc); } public void scr_DecelerationEnded(object sender,EventArgs e) {
float x1 = (float)this.img1.Frame.X;//获取图像img1 的x位置
float x2 = (float)this.img2.Frame.X;//获取图像img2的x位置
float x = (float)this.scr.ContentOffset.X;//获取视图对象scrolview scr 目前滚动的x位置 //判断x是否和x1相等
if (x == x1)
{
this.pagc.CurrentPage = ; }
else if (x == x2)
{
this.pagc.CurrentPage = ; }
else
{
this.pagc.CurrentPage = ; } }
public void pagc_ValueChanged(object sender, EventArgs e)
{
PointF pf = (PointF)this.scr.ContentOffset;
switch (this.pagc.CurrentPage) {
case :
pf.X = (float)this.img1.Frame.X;
this.scr.SetContentOffset(pf,true);
break;
case :
pf.X = (float)this.img2.Frame.X;
this.scr.SetContentOffset(pf, true);
break;
case :
pf.X = (float)this.img3.Frame.X;
this.scr.SetContentOffset(pf, true);
break;
default:
break;
}
}
357// 、警告视图
UIAlertView a = new UIAlertView();
a.Title = "提示";
a.Message = "电量不足";
a.AddButton("确定");
a.Show();
1、按钮 UIButton
                           UIButton btn = new UIButton();

btn.Frame = new RectangleF(150,310,80,30); //按钮位置一件宽高
            btn.SetTitle("Button",UIControlState.Normal); //显示的文字
            btn.SetTitleColor(UIColor.Black,UIControlState.Normal);//文字的颜色
            btn.TouchUpInside += this.SetBackGroudColor; //按钮 触摸事件
            this.View.AddSubview(btn); //添加到当前视图

2、图像视图 UIImageView
            UIImageView img=new UIImageView();
            img.Frame = new RectangleF(0,0,375,667); //设置位置大小
            img.ContentMode = UIViewContentMode.ScaleAspectFit; //设置图像视图模式
            img.Image = UIImage.FromFile("img.jpg"); //设置图像 
            img.Transform = CGAffineTransform.MakeRotation(20);//图像旋转正数顺时针旋转,负数逆时针旋转  
            img.Transform = CGAffineTransform.MakeScale(-2,2);  //图像缩放
            this.View.AddSubview(img); //添加到当前视图

3、label控件 UILabel

            UILabel lbl1 = new UILabel();
            lbl1.Frame = new RectangleF(2,410,155,28);
            lbl1.Text = "UILabel";
            lbl1.Lines = 3; //显示行数 配合   label高度 使用
            lbl1.LineBreakMode = UILineBreakMode.MiddleTruncation; //内容显示样式 
            lbl1.Hidden = true;  //是否显示
            this.View.AddSubview(lbl1);

4、输入框 UITextField
            UITextField  t1 = new UITextField();
            t1.BorderStyle = UITextBorderStyle.RoundedRect;
            t1.Frame = new RectangleF(50,250,300,30);
            t1.Placeholder = "账号";
            //  限制输入字符长度
            t1.ShouldChangeCharacters = (textField, range, replacementString) => {
                if (range.Location < 10)
                    return true;
                else
                    return false;
            };
            this.View.AddSubview(t1);
            UITextField t2 = new UITextField(); 

            t2.BorderStyle = UITextBorderStyle.RoundedRect;//边框样式
            t2.Frame = new RectangleF(50, 300, 300, 30);
            t2.Placeholder = "密码";
            t2.SecureTextEntry = true; //隐藏文本
            this.View.AddSubview(t2);  

UITextView text = new UITextView();
            text.Frame = new RectangleF(9, 90, 302, 180);

this.View.AddSubview(text);
5、UITextView 实现功能:点击完成按钮隐藏键盘,并且把text的Text值赋值给text1控件,并监控 text控件的状态(开始输入,结束输入,输入中)
            UITextView text1 = new UITextView();
            text1.Frame = new RectangleF(9, 330, 302, 180);
            text1.Editable = false;
            this.View.AddSubview(text1);
            text1.Hidden = true;
            UIButton btn = new UIButton();
            btn.Frame = new RectangleF(137,56,46,30);
            btn.SetTitle("完成", UIControlState.Normal);
            btn.SetTitleColor(UIColor.Red,UIControlState.Normal);
            this.View.AddSubview(btn);
            btn.TouchUpInside += (sender, e) => {
                text.ResignFirstResponder();
                text1.Hidden=false;
                text1.Text = text.Text;

};
            text.Delegate = new MyDelegate();

}
        private class MyDelegate : UITextViewDelegate
        {
            public override void EditingEnded(UITextView textView)
            {
                Console.WriteLine("Edit end");
            }
            public override void EditingStarted(UITextView textView)
            {
                Console.WriteLine("Edit start");
            }
            public override void Changed(UITextView textView)
            {
                Console.WriteLine("Edit ");
            }
        }  
6、 输入框键盘 样式类型 设置
            UITextField fied = new UITextField();
            fied.Frame = new RectangleF(50, 100, 300, 30);
            fied.BorderStyle = UITextBorderStyle.Line; 
            this.View.AddSubview(fied);  
            fied.KeyboardType = UIKeyboardType.Url;//设置键盘类型
            fied.KeyboardAppearance = UIKeyboardAppearance.Dark;// 设置键盘外观
            fied.ReturnKeyType = UIReturnKeyType.Next;//设置键盘的Return键

7、显示键盘 时改变输入框的位置
                 UITextField fied = new UITextField();

private NSObject kbdWillShow, kbdDidHide;

public override void ViewDidLoad()
        {
            base.ViewDidLoad(); 
            fied.Frame = new RectangleF(10, 500, 300, 30);
            fied.BorderStyle = UITextBorderStyle.RoundedRect; 
             this.View.AddSubview(fied);
            //显示键盘前 (事件)
            kbdWillShow = UIKeyboard.Notifications.ObserveWillShow((s, e) => {
                RectangleF kbdRounds = (RectangleF)e.FrameEnd;
                RectangleF textFrame = (RectangleF)fied.Frame;
                textFrame.Y -= kbdRounds.Height;
                fied.Frame = textFrame;
            });
            //隐藏键盘后  (事件)
            kbdDidHide = UIKeyboard.Notifications.ObserveDidHide((s, e) =>
            {
                RectangleF kbdRounds = (RectangleF)e.FrameEnd;
                RectangleF textFrame = (RectangleF)fied.Frame;
                textFrame.Y += kbdRounds.Height;
                fied.Frame = textFrame;
            });
            //键盘上的return键 隐藏键盘 (事件)
            fied.ShouldReturn=delegate(UITextField textField) {
                return textField.ResignFirstResponder();
            };
        }
 8、 为输入框键盘 添加工具栏
            UITextField fied = new UITextField();
            fied.Frame = new RectangleF(10, 200, 300, 30);
            fied.BorderStyle = UITextBorderStyle.RoundedRect;//设置输入框边框
             this.View.AddSubview(fied);
            fied.KeyboardType = UIKeyboardType.EmailAddress;//设置键盘类型
            //设施工具栏
            UIToolbar bar = new UIToolbar();//实例化工具栏
            bar.SizeToFit();
            bar.BackgroundColor = UIColor.DarkGray;//设置背景
            //实例化 工具栏 按钮
            UIBarButtonItem item = new UIBarButtonItem("完成", UIBarButtonItemStyle.Done, (s, e) =>
            {
                //隐藏键盘
                fied.ResignFirstResponder();
            });
            //为工具栏设置条目
            bar.SetItems(new UIBarButtonItem[]{ item},true);
            //为输入框 键盘添加工具栏
            fied.InputAccessoryView = bar;

9、文本视图菜单 退出按钮
         public override void ViewDidLoad()
        { 
            tf.Frame = new RectangleF(20,10,300,100); 
            this.View.AddSubview(tf);
            UIMenuItem item = new UIMenuItem("退出", new Selector("hide"));//添加菜单按钮

UIMenuController c = UIMenuController.SharedMenuController;
            c.MenuItems = new UIMenuItem[] { item };

}
        UITextView tf = new UITextView();
        [Export("hide")]
        public void hide() {
            //退出键盘
            tf.ResignFirstResponder();
        }

10、触摸背景隐藏键盘
        public override void ViewDidLoad()
        {
            tf.Frame = new RectangleF(10,50,300,30);
            tf.BorderStyle = UITextBorderStyle.RoundedRect;
            this.View.AddSubview(tf);
             
        }
        /// <summary>
        ///重写 ViewController 方法 TouchesBegan
        /// </summary>
        /// <param name="touches">Touches.</param>
        /// <param name="evt">Evt.</param>
        public override void TouchesBegan(NSSet touches, UIEvent evt)
        {
            tf.ResignFirstResponder();
        }  
11、进度条控件 UIProgressView 先在添加一个lable lbl 和一个button  sta
         public override void ViewDidLoad()
        {
                //按钮的触摸事件
                sta.TouchUpInside+=delegate {
                sta.Enabled = false;
                pv.Progress = 0f;
                //创建一个新的任务 用来计算 进度条的值 并更新视图 
                Task.Factory.StartNew(this.Start);
            };
            /创建进度条 并添加到视图 
            pv = new UIProgressView(new RectangleF(60f,200f,200f,50f));
            pv.Progress = 0f;
            f = 1f / 10f;
            this.View.AddSubview(pv);
        }
        UIProgressView pv;
        float f = 0f;
        public void Start() {
            float p = 0f;
            while (p<1f) {
                Thread.Sleep(1000);
                //调用主线程 修改视图
                this.InvokeOnMainThread(delegate {
                    pv.Progress += this.f;
                    p = pv.Progress;
                    lbl.Text = Math.Round(pv.Progress, 2).ToString();
                    if (p >= 1f)
                    {
                        lbl.Text = "加载完成!";
                        sta.Enabled = true;
                    }
                });
            }

}  
12、滚动视图
            (1).
        UIImageView img;
        UIScrollView scr;
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            img = new UIImageView(UIImage.FromFile("1.png"));
            scr = new UIScrollView();
            scr.Frame = new RectangleF(0,0,320,568);
            scr.ContentSize = img.Image.Size;            //滚动范围
            scr.ContentOffset = new PointF(200f,50f);   //目前滚动位置
            scr.PagingEnabled = true;                   //可以整页翻动
            scr.MinimumZoomScale=0.25f;                 //缩放最小比例
            scr.MaximumZoomScale=2f;                    //放大的最大比例    
            //获取要缩放的图像视图
            scr.ViewForZoomingInScrollView=delegate (UIScrollView scrll){
                return this.img;
            };
            scr.ZoomScale = 1f;                         //设置变化比例
            scr.IndicatorStyle = UIScrollViewIndicatorStyle.Black; //滚动指示器的风格设置
            scr.AddSubview(img);
            this.View.AddSubview(scr);
        }
         (2).
            UIScrollView scr = new UIScrollView();

scr.Frame = new RectangleF(0,0,325,568);
            scr.ContentSize = new SizeF(320,2000);
            this.View.AddSubview(scr);
            //滚动视图开始时调用 
            scr.Scrolled+=delegate {
                Console.WriteLine("Start rolling");
            };
            //滚动视图结束时调用 
            scr.DecelerationEnded+=delegate {
                Console.WriteLine("Start End");
            };
            float y = 10;
            for (float i = 1; i < 21; i++) {
                UILabel lab = new UILabel();
                lab.Frame = new RectangleF(0,y,320,50);
                lab.BackgroundColor = UIColor.Cyan;
                lab.Text = String.Format("{0}",i);
                scr.AddSubview(lab);
                y += 100;

            } 
13、页面控件
        UIImageView img1;
        UIImageView img2;
        UIImageView img3;
        UIScrollView scr;
        UIPageControl pagc;
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            //添加滚动视图
            scr = new UIScrollView();
            scr.Frame = new RectangleF(0,0,320,495);
            //滚动视图结束滚动时调用
            scr.DecelerationEnded += this.scr_DecelerationEnded;
            //添加页面
            pagc = new UIPageControl();
            pagc.Frame = new RectangleF(0,540,320,37);
            pagc.Pages = 3; //设置页面数值 及页面小白点
            //当页面数值发生改变时调用
            pagc.ValueChanged += this.pagc_ValueChanged;
            //滚动视图的滚动事件
            scr.Scrolled+=delegate {
                Console.WriteLine("Scolled!");
            };
            scr.PagingEnabled = true;
            RectangleF rf = (RectangleF)scr.Frame;
            scr.ContentSize = new SizeF(rf.Width*3,rf.Height);
            //添加图像视图
            img1 = new UIImageView();
            img1.ContentMode = UIViewContentMode.ScaleAspectFit;
            img1.Image = UIImage.FromFile("1.jpg");
            rf.X += (float)this.scr.Frame.Width;
            img2 = new UIImageView();
            img2.ContentMode = UIViewContentMode.ScaleAspectFit;
            img2.Image = UIImage.FromFile("2.jpg");
            rf.X += (float)this.scr.Frame.Width;
            img3 = new UIImageView();
            img3.ContentMode = UIViewContentMode.ScaleAspectFit;
            img3.Image = UIImage.FromFile("3.jpg");
            rf.X += (float)this.scr.Frame.Width;

scr.AddSubview(img1);
            scr.AddSubview(img2);
            scr.AddSubview(img3);
            this.View.AddSubview(scr);
            this.View.AddSubview(pagc);

}

public void scr_DecelerationEnded(object sender,EventArgs e) {
            float x1 = (float)this.img1.Frame.X;//获取图像img1 的x位置
            float x2 = (float)this.img2.Frame.X;//获取图像img2的x位置
            float x = (float)this.scr.ContentOffset.X;//获取视图对象scrolview scr 目前滚动的x位置

//判断x是否和x1相等
            if (x == x1)
            {
                this.pagc.CurrentPage = 0;

}
            else if (x == x2)
            {
                this.pagc.CurrentPage = 1;

}
            else 
            { 
                this.pagc.CurrentPage = 2;
            
            }

}
        public void pagc_ValueChanged(object sender, EventArgs e)
        {
            PointF pf = (PointF)this.scr.ContentOffset;
            switch (this.pagc.CurrentPage) {
                case 0:
                    pf.X = (float)this.img1.Frame.X;
                    this.scr.SetContentOffset(pf,true);
                    break;
                case 1:
                    pf.X = (float)this.img2.Frame.X;
                    this.scr.SetContentOffset(pf, true);
                    break;
                case 2:
                    pf.X = (float)this.img3.Frame.X;
                    this.scr.SetContentOffset(pf, true);
                    break;
                default:
                    break;
            }
        }   

14、警告视图
            UIAlertView a = new UIAlertView();
            a.Title = "提示";
            a.Message = "电量不足";
            a.AddButton("确定");
            a.Show();

Xamarin.ios 基本控件的更多相关文章

  1. Xamarin Studio在Mac环境下的配置和Xamarin.iOS常用控件的示例

    看过好多帖子都是Win环境装XS,Mac只是个模拟器,讲解在Mac环境下如何配置Xamarin Studio很少,也是一点点找资料,东拼西凑才把Xamarin Studio装在Mac上跑起来,如下: ...

  2. JS调用Android、Ios原生控件

    在上一篇博客中已经和大家聊了,关于JS与Android.Ios原生控件之间相互通信的详细代码实现,今天我们一起聊一下JS调用Android.Ios通信的相同点和不同点,以便帮助我们在进行混合式开发时, ...

  3. 初识IOS,Label控件的应用。

    初识IOS,Label控件的应用. // // ViewController.m // Gua.test // // Created by 郭美男 on 16/5/31. // Copyright © ...

  4. IOS—UITextFiled控件详解

    IOS—UITextFiled控件详解 //初始化textfield并设置位置及大小 UITextField *text = [[UITextField alloc]initWithFrame:CGR ...

  5. [iOS基础控件 - 5.5] 代理设计模式 (基于”APP列表"练习)

    A.概述      在"[iOS基础控件 - 4.4] APP列表 进一步封装,初见MVC模式”上进一步改进,给“下载”按钮加上效果.功能      1.按钮点击后,显示为“已下载”,并且不 ...

  6. android 仿ios开关控件

    ios一些控件还是挺美丽的,可是对android程序猿来说可能比較苦逼,由于ios一些看起来简单的效果对android来说可能就没那么简单了,可是没办法非常多产品都是拿ios的一些控件叫android ...

  7. Xamarin.Forms单元控件Cell

    Xamarin.Forms单元控件Cell   单元控件Cell是Xamarin.Forms为ListView和TableView专门定制的一类项目元素.它包括5个控件,分别为文本框单元EntryCe ...

  8. Xamarin.Forms XAML控件的公共属性

    Xamarin.Forms XAML控件的公共属性   Xamarin.Forms XAML控件有很多.通过官网API,可以查看每个控件的属性.但是官网只给出了控件的特有属性,而公共属性没有列出.所以 ...

  9. 79.iOS 设备的UI规范和iOS各控件默认高度

    iOS设备的UI 规范 iPhone界面尺寸 iPhone图标尺寸 iPad的设计尺寸 iPad图标尺寸 iPhone设备尺寸分辨率比例 iPhone各设备 launch image iOS 各种控件 ...

随机推荐

  1. AlloyRenderingEngine燃烧的进度条

    写在前面 Github: https://github.com/AlloyTeam/AlloyGameEngine HTML 5新增了progress标签,那么再去使用AlloyRenderingEn ...

  2. 正则表达式在iOS中的运用

    1.什么是正则表达式 正则表达式,又称正规表示法,是对字符串操作的一种逻辑公式.正则表达式可以检测给定的字符串是否符合我们定义的逻辑,也可以从字符串中获取我们想要的特定部分.它可以迅速地用极简单的方式 ...

  3. 【转】深入浅出JavaScript之闭包(Closure)

    闭包(closure)是掌握Javascript从人门到深入一个非常重要的门槛,它是Javascript语言的一个难点,也是它的特色,很多高级应用都要依靠闭包实现.下面写下我的学习笔记~ 闭包-无处不 ...

  4. win7的6个网络命令

    1 名称: Ipconfig 参数: /all : 显示详细信息 /renew: 更新所有适配器 /renew EL*:更新所有名称以EL为开头的连接 /release *Con*: 释放所有匹配的连 ...

  5. ASP.NET MVC 身份认证

    身份认证的好处就是, 如果这个页面没有登录, 刷新后会自动跳到登录页要求登录,保证了应用程序的安全.而Forms 身份认证是web下最常用的,如何配置呢?见下(基于mvc 4) 1.在webconfi ...

  6. java中使用javamail发送邮件

    1. 电子邮件协议 电子邮件的在网络中传输和网页一样需要遵从特定的协议,常用的电子邮件协议包括 SMTP,POP3,IMAP. 其中邮件的创建和发送只需要用到 SMTP协议,所有本文也只会涉及到SMT ...

  7. MySQL 临时表

    MySQL 临时表在我们需要保存一些临时数据时是非常有用的.临时表只在当前连接可见,当关闭连接时,Mysql会自动删除表并释放所有空间. 临时表在MySQL 3.23版本中添加,如果你的MySQL版本 ...

  8. 详解Linux交互式shell脚本中创建对话框实例教程_linux服务器

    本教程我们通过实现来讲讲Linux交互式shell脚本中创建各种各样对话框,对话框在Linux中可以友好的提示操作者,感兴趣的朋友可以参考学习一下. 当你在终端环境下安装新的软件时,你可以经常看到信息 ...

  9. Linux 关于Transparent Hugepages的介绍

    透明大页介绍 Transparent Huge Pages的一些官方介绍资料: Transparent Huge Pages (THP) are enabled by default in RHEL ...

  10. [css]全屏背景图片设置,django加载图片路径

    <head><style type="text/css"> #bg { position:fixed; top:; left:; width:100%; h ...