首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >景观设计与人像模式的单调旋转

景观设计与人像模式的单调旋转
EN

Stack Overflow用户
提问于 2012-02-21 11:36:32
回答 1查看 2K关注 0票数 2

我是iPad开发人员的新手,

我使用iPad在目标c中创建了两个或三个Xcode 4.应用程序。

但是现在我想用iPad语言中的Monodeveloper工具创建C#应用程序.

其中,我想把我的tableView转移到orientation

我在谷歌搜索,但我没有任何语法。

详情见我的屏幕快照..。

在第一个图像(纵向模式)中,我的表位于extremeLeft,在第二个图像(景观模式)中,我希望我的表处于极右。

我该怎么做?

我通过编程创建了tableview,这是代码片段,

代码语言:javascript
复制
public override void ViewDidLoad ()
        {
            base.ViewDidLoad ();
            Gainer();   //method call
                UITableView Table=new UITableView();
            Table.Frame=new RectangleF(20,200,400,400);
            Table.Source=new TableViewDataSource(TopGainer); //passing parameter to tableview datasource 
            this.View.AddSubview(Table);


        }

public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation)
        {
            // Return true for supported orientations
            return true;
        }

任何帮助都将不胜感激.

,提前谢谢!!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-02-22 02:21:13

您可以重写WillRotate方法,并根据UIScreen.MainScreen提供的值在任何情况下应用您想要的确切位置。例如。

代码语言:javascript
复制
    public override void WillRotate (UIInterfaceOrientation toInterfaceOrientation, double duration)
    {
        switch (toInterfaceOrientation) {
        case UIInterfaceOrientation.LandscapeLeft:
        case UIInterfaceOrientation.LandscapeRight:
            Table.Frame = new RectangleF (UIScreen.MainScreen.Bounds.Width - 20 - Table.Frame.Width, 200, 400, 400);
            break;
        case UIInterfaceOrientation.Portrait:
        case UIInterfaceOrientation.PortraitUpsideDown:
            Table.Frame = new RectangleF (20, 200, 400, 400);
            break;
        }
        base.WillRotate (toInterfaceOrientation, duration);
    }
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9376893

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档