protected void OnDeviceRotated(NSNotification notification) { if (AppDelegate.IsPad) { SizeF size; if (IsPortrait) { XamLogoImageView.Image = UIImage.FromBundle("/Images/About-Portrait~iPad"); ScrollView.ContentSize = new SizeF(768, 1004); size = AboutTextView.StringSize(AboutTextView.Text , AboutTextView.Font , new SizeF(738, 500) , UILineBreakMode.WordWrap); AboutTextView.Frame = new RectangleF( 15, 650, size.Width, size.Height + 30); } else { // IsLandscape XamLogoImageView.Image = UIImage.FromBundle("/Images/About-Landscape~iPad"); ScrollView.ContentSize = new SizeF(1024, 748); size = AboutTextView.StringSize(AboutTextView.Text , AboutTextView.Font , new SizeF(1004, 500) , UILineBreakMode.WordWrap); AboutTextView.Frame = new RectangleF( 15, 500, size.Width, size.Height + 30); } var Y = AboutTextView.Frame.Y + size.Height + 30; LayoutButtons(Y); } }
public override void ViewDidLoad() { base.ViewDidLoad(); Title = "About Xamarin"; StackOverflowButton.SetBackgroundImage(UIImage.FromFile("Images/Logos/logo_stackoverflow.png"), UIControlState.Normal); LinkedInButton.SetBackgroundImage(UIImage.FromFile("Images/Logos/logo_linkedin.png"), UIControlState.Normal); TwitterButton.SetBackgroundImage(UIImage.FromFile("Images/Logos/logo_twitter.png"), UIControlState.Normal); YouTubeButton.SetBackgroundImage(UIImage.FromFile("Images/Logos/logo_youtube.png"), UIControlState.Normal); FacebookButton.SetBackgroundImage(UIImage.FromFile("Images/Logos/logo_facebook.png"), UIControlState.Normal); BlogRssButton.SetBackgroundImage(UIImage.FromFile("Images/Logos/logo_rss.png"), UIControlState.Normal); StackOverflowButton.TouchUpInside += (sender, e) => { OpenUrl(Constants.AboutUrlStackOverflow); }; LinkedInButton.TouchUpInside += (sender, e) => { OpenUrl(Constants.AboutUrlLinkedIn); }; TwitterButton.TouchUpInside += (sender, e) => { OpenUrl(Constants.AboutUrlTwitter); }; YouTubeButton.TouchUpInside += (sender, e) => { OpenUrl(Constants.AboutUrlYouTube); }; FacebookButton.TouchUpInside += (sender, e) => { OpenUrl(Constants.AboutUrlFacebook); }; BlogRssButton.TouchUpInside += (sender, e) => { OpenUrl(Constants.AboutUrlBlogRss); }; if (AppDelegate.IsPhone) { ScrollView.Frame = new RectangleF(0, 43, 320, 367); ScrollView.ContentSize = new SizeF(320, 610); XamLogoImageView.Image = UIImage.FromBundle("/Images/About"); AboutTextView.Frame = new RectangleF( AboutTextView.Frame.X, AboutTextView.Frame.Y, 320, 240); var Y = AboutTextView.Frame.Y + 240; StackOverflowButton.Frame = new RectangleF(StackOverflowButton.Frame.X, Y, StackOverflowButton.Frame.Width, StackOverflowButton.Frame.Height); LinkedInButton.Frame = new RectangleF(LinkedInButton.Frame.X, Y, LinkedInButton.Frame.Width, LinkedInButton.Frame.Height); TwitterButton.Frame = new RectangleF(TwitterButton.Frame.X, Y, TwitterButton.Frame.Width, TwitterButton.Frame.Height); YouTubeButton.Frame = new RectangleF(YouTubeButton.Frame.X, Y, YouTubeButton.Frame.Width, YouTubeButton.Frame.Height); FacebookButton.Frame = new RectangleF(FacebookButton.Frame.X, Y, FacebookButton.Frame.Width, FacebookButton.Frame.Height); BlogRssButton.Frame = new RectangleF(BlogRssButton.Frame.X, Y, BlogRssButton.Frame.Width, BlogRssButton.Frame.Height); } else { // IsPad ScrollView.Frame = new RectangleF(0, 0, 768, 1004); ScrollView.ContentSize = new SizeF(768, 1024); XamLogoImageView.Image = UIImage.FromBundle("/Images/About-Portrait~iPad"); XamLogoImageView.Frame = ScrollView.Frame; SizeF size = AboutTextView.StringSize(AboutTextView.Text , AboutTextView.Font , new SizeF(738, 500) , UILineBreakMode.WordWrap); AboutTextView.Frame = new RectangleF( 15, 650, size.Width, size.Height + 30); //AboutTextView.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleWidth; var Y = AboutTextView.Frame.Y + size.Height + 40; StackOverflowButton.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin; LinkedInButton.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin; TwitterButton.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin; YouTubeButton.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin; BlogRssButton.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin; FacebookButton.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin; LayoutButtons(Y); } AboutTextView.Text = Constants.AboutText; // @"Xamarin was founded in 2011 with the mission to make it fast, easy and fun to build great mobile apps. Xamarin’s products are used by individual developers and companies, including VMware, Target, Rdio, Medtronic and Unity Technologies, to simplify creation and operation of high-performance, cross-platform mobile consumer and corporate applications, targeting phones and tablets running iOS, Android and Windows. For more information, visit http://xamarin.com."; }