zoukankan      html  css  js  c++  java
  • searbar

    //
    //  RNContainerController.m
    //  TestingSearchBar
    //
    //  Created by Ryan Nystrom on 5/19/14.
    //  Copyright (c) 2014 Ryan Nystrom. All rights reserved.
    //

    #import "RNContainerController.h"
    #import "RNTableViewController.h"

    @interface RNContainerController ()

    @property (nonatomic, strong) RNTableViewController *tableViewController;
    @property (nonatomic, strong) UISearchDisplayController *searchController;

    @end

    @implementation RNContainerController

    - (void)viewDidLoad {
        [super viewDidLoad];
        
        self.title = @"Container";
        
        self.tableViewController = [[RNTableViewController alloc] init];
        [self rn_addChildViewController:self.tableViewController];
        
        self.searchController = [[UISearchDisplayController alloc] initWithSearchBar:self.tableViewController.searchBar contentsController:self];
    }

    - (void)viewWillAppear:(BOOL)animated {
        [super viewWillAppear:animated];
        self.tableViewController.view.frame = self.view.bounds;
    }

    - (BOOL)shouldAutomaticallyForwardAppearanceMethods {
        return YES;
    }

    - (void)rn_addChildViewController:(UIViewController *)controller {
        [controller beginAppearanceTransition:YES animated:NO];
        [controller willMoveToParentViewController:self];
        [self addChildViewController:controller];
        [self.view addSubview:controller.view];
        [controller didMoveToParentViewController:controller];
        [controller endAppearanceTransition];
    }

    - (void)rn_removeChildViewController:(UIViewController *)controller {
        if ([self.childViewControllers containsObject:controller]) {
            [controller beginAppearanceTransition:NO animated:NO];
            [controller willMoveToParentViewController:nil];
            [controller.view removeFromSuperview];
            [controller removeFromParentViewController];
            [controller didMoveToParentViewController:nil];
            [controller endAppearanceTransition];
        }
    }

    @end

  • 相关阅读:
    小问题也是大问题
    Java GC(2)
    Java GC(1)
    mac eclipse svn
    svn merge
    LTE,WiMAX与WIFI相关知识链接整理
    【LTE基础知识】承载相关概念介绍
    【LTE基础知识】LTE空口协议分析
    LTE基础知识
    Scapy学习2
  • 原文地址:https://www.cnblogs.com/lidongq/p/5213633.html
Copyright © 2011-2022 走看看