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];//添加,此处可用 |
        
        //..
    }

     

    不是很具体,这是总结。

    求指点~

  • 相关阅读:
    Git工作中用法(Gitlab)
    面试记录,不定时更新中。。。
    webservice 技术改进
    HTTP详解
    Git学习05 --分支管理02
    Git学习04 --分支管理
    链表判环问题
    k-选取问题
    图片与字符串(base64编码)的转化
    二叉堆与堆排序的简单实现
  • 原文地址:https://www.cnblogs.com/maxfong/p/2489582.html
Copyright © 2011-2022 走看看