Last active
September 8, 2017 10:20
-
-
Save amay077/6062566 to your computer and use it in GitHub Desktop.
Xamarin.iOS で、スワイプで View を切り替える方法 ref: http://qiita.com/amay077/items/0a79ef6f091f17ff0fe9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public override void ViewDidLoad() | |
| { | |
| base.ViewDidLoad(); | |
| SizeF imageSize = new SizeF(320f, 460f); | |
| for (int i = 0; i < 3; i++) | |
| { | |
| var image = UIImage.FromFile(String.Format("image{0}.png", i)); | |
| var imgView = new UIImageView(image); | |
| // x方向にずらしながら… | |
| imgView.Frame = new RectangleF(imageSize.Width * i, 0f, | |
| imageSize.Width, imageSize.Height); | |
| // 子として追加。 | |
| scrollView.AddSubview(imgView); | |
| } | |
| // スクロール可能領域を設定する | |
| scrollView.ContentSize = new SizeF(imageSize.Width * 3, imageSize.Height); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment