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.lang.ArrayIndexOutOfBoundsException异常分析及解决
    Android_开发片段(Part 2)
    保存错误日志回传服务器之回传错误“信息文件”
    node.js
    拼接json
    CommonJS / Node.js/ Vue学习资料
    合并PDF
    java 多线程
    linux 运行jar包
    mvn 命令
  • 原文地址:https://www.cnblogs.com/lidongq/p/5213633.html
Copyright © 2011-2022 走看看