码迷,mamicode.com
首页 > 移动开发 > 详细

【 Beginning iOS 7 Development《精通iOS7开发》】06 Multiview Applications

时间:2014-07-21 11:16:24      阅读:337      评论:0      收藏:0      [点我收藏+]

标签:ios

一、典型多视图应用


1、TAB BAR。

bubuko.com,布布扣


bubuko.com,布布扣




2、NAVIGATION BAR

bubuko.com,布布扣





3、TAB+NAVIGATION


bubuko.com,布布扣



4、TOOL BAR


bubuko.com,布布扣


二、新建一个多视图APP


1、APP效果演示


bubuko.com,布布扣


2、项目结构


bubuko.com,布布扣



//
//  BIDSwitchViewController.m
//  View Switcher
//
//  Created by jason on 14-7-17.
//  Copyright (c) 2014年 jason. All rights reserved.
//

#import "BIDSwitchViewController.h"

@interface BIDSwitchViewController ()

@end

@implementation BIDSwitchViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.blueViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"Blue"];
    [self.view insertSubview:self.blueViewController.view atIndex:0];
}

- (void)didReceiveMemoryWarning
{
//    回收两个子视图
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
    if (!self.blueViewController.view.superview) {
        self.blueViewController = nil;
    }else{
        self.yellowViewController = nil;
    }
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

//切换逻辑、切换动画
-(IBAction)switchViews:(id)sender
{
    [UIView beginAnimations:@"View Flip" context:NULL];
    [UIView setAnimationDuration:0.4];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
    if (!self.yellowViewController.view.superview) {
        if (!self.yellowViewController) {
            self.yellowViewController = [self.storyboard
                                         instantiateViewControllerWithIdentifier:@"Yellow"];
        }
        [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight
                               forView:self.view cache:YES];
        [self.blueViewController.view removeFromSuperview];
        [self.view insertSubview:self.yellowViewController.view atIndex:0];
    }else{
        if (!self.blueViewController) {
            self.blueViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"Blue"];
            }
        [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft
                               forView:self.view cache:YES];
        [self.yellowViewController.view removeFromSuperview];
        [self.view insertSubview:self.blueViewController.view atIndex:0];
    }
    [UIView commitAnimations];
}

@end


3、代码下载:

        https://github.com/Simba-Hu/View-Switcher.git

        git@github.com:Simba-Hu/View-Switcher.git



三、小结

View Controller 

Storyboard 

UIViewController 

Empty Application 

Toolbar 

the object attributes inspector

 control-drag 

 App Delegate 

Show Quick Help Inspector 

lazy loading,

superview 

Content Views 

Main.storyboard

Interface Builder

the object library 

scene 

Editor - Align- Horizontal Center inContainer  

Editor- Align- VerticalCenter in Container 

the connections inspector 

Touch Up Insideevent  

File’sOwnericon 

background 

the attributes inspector  

the identity inspector  

the color picker 

constraints 

Transition 

【 Beginning iOS 7 Development《精通iOS7开发》】06 Multiview Applications

标签:ios

原文地址:http://blog.csdn.net/gogler/article/details/38011113

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!