没有与时俱进,发现从ios5以来,居然不知道怎么处理旋转控制了

首先,appdelegate里面可以控制全局的,比如控制ipad随便转,iphone不转:

- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {

    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
        // iPad
        return UIInterfaceOrientationMaskAll;
    } else {
        // iPhone / iPod Touch
        return UIInterfaceOrientationMaskPortrait;
    }
    
}


其次,如果需要每个去控制,可以是这样:

How to support one or more landscape controllers in app that is portrait mainly in ios6:

1) in AppDelegate

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
    {
        UINavigationController* ns = (UINavigationController*)self.window.rootViewController;
        if (ns) {
            UIViewController* vc = [ns visibleViewController];
//by this UIViewController that needs landscape is identified
            if ([vc respondsToSelector:@selector(needIos6Landscape)])
                return [vc supportedInterfaceOrientations];

        }
        return UIInterfaceOrientationMaskPortrait; //return default value
    }


2) in UIView controller(s) that needs landscape (or portrait+lanscape etc):

//flag method
-(void)needIos6Landscape {
}
- (BOOL)shouldAutorotate
{
    return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskAllButUpsideDown;
}


3) in controllers, to which you can RETURN from controllers, that can be rotated in landscape - this is important, otherwise they remaind landscape on return from landscape-enabled VC.

- (BOOL)shouldAutorotate
{
    return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait;
}


4) (maybe not needed, but for sure..) - subclass navigation controller(s) you using, and add:

- (BOOL)shouldAutorotate
{
    return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
    UIViewController* vc = [self visibleViewController];
    if (vc) {
        if ([vc respondsToSelector:@selector(needIos6Landscape)]) {
             return [vc supportedInterfaceOrientations];
        }
    }
    return UIInterfaceOrientationMaskPortrait;
}


The important step is to ask for orientation only controllers from your app, because during transition between controllers, for some time there is some system controller as root, and will return incorrect value (this took me 2 hrs to find out, it was reason it was not working).

引自:http://stackoverflow.com/q...
service postfix start
Starting postfix:                                          [FAILED]


今天启动一个新服务器的postfix,一直都提示失败
重新安装也没用,也没有错误输出

检查postfix命令:
which postfix
/usr/sbin/postfix

执行看看:
# /usr/sbin/postfix
postfix: fatal: parameter inet_interfaces: no local interface found for ::1

编辑配置文件
# vi /etc/postfix/main.cf
把 inet_interfaces 设置为 all

再次启动:
# service postfix start
Starting postfix:                                          [  OK  ]
分页: 1/1 第一页 1 最后页 [ 显示模式: 摘要 | 列表 ]

阅读推荐

服务器相关推荐

开发相关推荐

应用软件推荐