zoukankan      html  css  js  c++  java
  • FirstApp,iphone开发学习总结9,旋转

    添加Rotation文件,用类别为UITabBarController添加旋转:

    //Rotation.h文件
    #import <Foundation/Foundation.h>

    @interface UITabBarController(Rotation)
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)x;
    @end

     Rotation.m文件:

    #import "Rotation.h"

    @implementation UITabBarController(Rotation)
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)x {
        return YES;
    }

    @end

    在ButtonViewController.m文件中添加:

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)x
    {
        return YES;//此处判定方向,达到要求才旋转
    }

    //此时可以旋转了

    修改right按钮,修改ButtonViewController.h:

    @interface ButtonViewController : UIViewController{
        UIButton *rightBtn;
    }
    @end

     修改ButtonViewController.m文件内的- (void)viewDidLoad:

    - (void)viewDidLoad
    {
        //..
        rightBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];//修改
        //..
        [rightBtn setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin];//添加,此处可用 |
        
        //..
    }

     

    不是很具体,这是总结。

    求指点~

  • 相关阅读:
    [C]static变量详解
    [LINUX]重定向
    [PHP]一些坑
    [PHP]常量的一些特性
    [数学]三角函数(一)
    [PHP]session的一些要点
    [C]控制外部变量访问权限的extern和static关键字
    c语言基础----共用体
    c语言基础----字符串数组
    c语言基础----函数库
  • 原文地址:https://www.cnblogs.com/maxfong/p/2489582.html
Copyright © 2011-2022 走看看