• ios-UITabBarcontroller 仿QQ 微信框架的界面跳转


    首先Xcode6  不允许新建空项目 所以

    Xcode 6 正式版如何创建一个Empty Application

    • |
    • 浏览:6435
    • |
    • 更新:2015-07-10 11:22
    • Xcode 6 正式版如何创建一个Empty Application1
    • Xcode 6 正式版如何创建一个Empty Application2
    • Xcode 6 正式版如何创建一个Empty Application3
    • Xcode 6 正式版如何创建一个Empty Application4
    • Xcode 6 正式版如何创建一个Empty Application5
    • Xcode 6 正式版如何创建一个Empty Application6
    • Xcode 6 正式版如何创建一个Empty Application7
    分步阅读

    Xcode 6 正式版里面没有Empty Application这个模板,这对于习惯了纯代码编写UI界面的程序员来说很不习惯。

    有网友给出了一个解决方法是,把Xcode 6 beta版里面的模板复制过去。

    但是,如果性急的你已经把Xcode 6 beta彻底删除,网上又找不到Empty Application模板的下载,怎么办?总不用重新把几个G的Xcode 6 beta重新下一遍吧?

    本文介绍在Xcode 6正式版,如何将一个Single View Application变为你熟悉的Empty Application。此方法对OC、Swift语言开发均适用。

    工具/原料

    • Xcode 6正式版

    示例

    1.  

      运行Xcode 6,创建一个Single View Application工程。

      Xcode 6 正式版如何创建一个Empty Application
    2.  

      创建好后,把工程目录下的Main.storyboard和LaunchScreen.xib删除,扔进废纸篓。

      Xcode 6 正式版如何创建一个Empty Application
    3.  

      打开Info.plist,把Launch screen interface file base name,以及Main storyboard file base name两项,删除(点击旁边的减号即可)。

      Xcode 6 正式版如何创建一个Empty Application
    4.  

      打开工程项目属性文件,点击Target下面的第一项,再选择General选项卡,向下找到Use Asset Catalog按钮。点击它。

      Xcode 6 正式版如何创建一个Empty Application
    5.  

      弹出对话框,点击Migrate即可。这样,应用尺寸就能根据屏幕大小进行调整了。

      Xcode 6 正式版如何创建一个Empty Application
    6.  

      最后,在AppDelegate的第一个方法里面,“return”语句之前,添加必要代码。

      代码只有3句,相当于分3步走。1.创建window;2.设置window背景;3.使window可见。

      OC和Swift的语法略有不同,但代码内容基本一致。

      //OC需要添加的代码

      self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

      self.window.backgroundColor = [UIColor whiteColor];

      [self.window makeKeyAndVisible];

      //Swift需要添加的代码

      self.window = UIWindow(frame: UIScreen.mainScreen().bounds)

      self.window?.backgroundColor = UIColor.whiteColor()

      self.window?.makeKeyAndVisible()

      Xcode 6 正式版如何创建一个Empty Application
      然后 在appdelegate 写入代码
      //
      //  AppDelegate.m
      //  UITabBarcontroller
      //
      //  Created by YaguangZhu on 15/9/7.
      //  Copyright (c) 2015年 YaguangZhu. All rights reserved.
      //
      
      #import "AppDelegate.h"
      
      @interface AppDelegate ()
      
      @end
      
      @implementation AppDelegate
      
      
      - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
          // Override point for customization after application launch.
          self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
          self.window.backgroundColor = [UIColor whiteColor];
          [self.window makeKeyAndVisible];
          
          UITabBarController *tab = [[UITabBarController alloc] init];
          self.window.rootViewController = tab;
          
          UIViewController *vc1 = [[UIViewController alloc]init];
          vc1.view.backgroundColor = [UIColor redColor];
          vc1.tabBarItem.title=@"消息";
          vc1.tabBarItem.image = [UIImage imageNamed:@"vip"];
          
          UIViewController *vc2 = [[UIViewController alloc]init];
          vc2.view.backgroundColor = [UIColor blueColor];
          vc2.tabBarItem.title=@"联系人";
          vc2.tabBarItem.image = [UIImage imageNamed:@"vip"];
          
          
          UIViewController *vc3 = [[UIViewController alloc]init];
          vc3.view.backgroundColor = [UIColor greenColor];
          vc3.tabBarItem.title=@"动态";
          vc3.tabBarItem.image = [UIImage imageNamed:@"vip"];
          
          tab.viewControllers = @[vc1,vc2,vc3];
          return YES;
      }
      
      - (void)applicationWillResignActive:(UIApplication *)application {
          // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
          // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
      }
      
      - (void)applicationDidEnterBackground:(UIApplication *)application {
          // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
          // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
      }
      
      - (void)applicationWillEnterForeground:(UIApplication *)application {
          // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
      }
      
      - (void)applicationDidBecomeActive:(UIApplication *)application {
          // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
      }
      
      - (void)applicationWillTerminate:(UIApplication *)application {
          // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
      }
      
      @end
       
  • 相关阅读:
    andriod 支付宝类似界面图片加文字
    评分条RatingBar Android
    Android 进度条对话框ProgressDialog
    Android 日期对话框DatePickerDialog
    andriod GridLayout
    android:TableLayout表格布局详解
    ArcGIS 10 SP5中文版(ArcGIS10补丁5中文版)
    Engine中如何进行七参数投影转换?
    如何去除栅格影像的黑边?
    资管机构年中规模排名出炉:中信资管规模超万亿
  • 原文地址:https://www.cnblogs.com/zhuyaguang/p/4788922.html
Copyright © 2020-2023  润新知