All day long , This article summarizes ios7.0 Page Jump related content

storyboard The hidden rules of

I touch ios Very late , The environment has been xcode5+ios7, So for the old IOS Development patterns don't understand . I looked up a lot of information on the Internet , Find previous code , A lot of them need to be themselves coding To create ViewController, such as :

  1. WTwoViewController *controller = [[WTwoViewController alloc]initWithNibName:@"WTwoViewController" bundle:nil];
  2. [self presentViewController:controller animated:YES completion:nil];

But with storyboard To manage view controller Words ,storyboard Automatic processing view controller The initialization action of , So you don't need to be yourself anymore coding To create view controller Example . See this sentence in another blog :

“ Used to xib I believe a lot of people will often use -presentModalViewController:animated: as well as -pushViewController:animated: These two methods . This code is in storyboard It's going to be history ; In its place Segue”

Control based jump

use storyboard Do development , It's often necessary to pull wires , Not covered in this article , Look at this official document :

start developing iOS app today

This kind of guy wire , It's from button Pull to view controller:

This way, just click on this button, It will jump automatically , No need to write any code

Directly from controller To controller

 
This kind of guy wire is directly from the View Controller To View Controller:
 
This approach has been pre created segue, But it needs to be hand coded , First of all, I need to give segue Set up a identity
 
Then write the code to jump :
  1. //  Jump to bootstrap
  2. - (void) jumpToBootstrap{
  3. [self performSegueWithIdentifier:@"fromWelcomeToBootstrap" sender:self];
  4. }

This code has to be written in -viewDidAppear in , Can not be written in -viewDidLoad in , Otherwise, a mistake will be reported :whose view is not in window hierarchy!

 

Value transfer between pages

 
Previously used -presentModalViewController:animated: The way to jump , It usually needs to pass delegate And so on , Now we all use segue API You can get
 
stay segue Before it happened , The current View Controller Of -prepareForSegue:sender: Method , You can do something inside , such as :
  1. BootstrapViewController* targetController = [segue destinationViewController];//  Get the goal view controller, Then you can do whatever you want

But what we should pay attention to here is , It doesn't seem to work in prepareForSegue Method destination view controller Of view, Because at this time view Not yet. storyboard Instantiation . But you can pass the reference first , Set it up later

 
In addition, I see a lot of posts on the Internet , It's said that from the beginning B go back to A If you also need to transfer the value when you need to , You can put A Set to B Of delegate:
  1. BViewController.delegate = self;

I don't quite understand here , When from B go back to A When , Also set up a segue It seems to be OK

 

unwind segue

 
unwind segue A special , It's about the goal View Controller First set up a action, And then in source View Controller Pull the line in to exit On the icon . In this case , In addition to calling source Of prepareForSegue Out of the way ,target View Controller the action It's also called .

ios7.0 combination storyborad Realize the summary of page Jump more related articles

  1. react-router 4.0( Four ) Page Jump verification prompt

    import React from 'react' import ReactDOM from 'react-dom' import { HashRouter, Route, Link, Prompt ...

  2. Customize PHP Page jump function redirect($url, $time = 0, $msg = '')

    utilize PHP Of header() function , Can realize the page Jump , Such as header("Location: " . $url); But it has a drawback , once HTTP Header block has been sent , You can't use it header ...

  3. Android 7.0 Gallery Library source code analysis 4 - SlotView Gesture monitoring and page Jump

    The last article talked about initialization View Will instantiate a SlotView And monitor its events , As for how it works , It's using Android Self contained GestureDetector. GestureDetector yes Android Bring their own ...

  4. ThinkPHP5.0 Framework development to achieve a simple page Jump

    ThinkPHP5.0 Framework development to achieve a simple page Jump One . effect Login screen Login success screen Login failure interface Two . Directory structure 3、 ... and . Code In the controller Login.php <?php // Declare a namespace names ...

  5. use weexplus from 0 To 1 Write a app(2)- Page Jump and the preparation of article list and article details

    explain The end of several consecutive days of overtime , The latest project has finally come to an end , Take some time today to continue to write my long delayed < use weexplus from 0 To 1 Write a app> Series articles . When I write this article ,weexplus The author of w ...

  6. web How to design page Jump

    One .asp.net c# Open a new page or page Jump 1. The most common page Jump ( The original window is replaced ):Response.Redirect("newpage.aspx"); 2. utilize url The address is ...

  7. Html Set the page not to jump to other pages

    Html Set the page not to jump to other pages <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" & ...

  8. Ajax send out POST request SpringMVC Page Jump failed

    Problem description : Because it uses SpringMVC frame , So I want to use ModelAndView Page Jump . The idea is to send POST request , then controller Layer directly returns the corresponding ModelAndView, But this method can't be ...

  9. PHP Page Jump (PHP note )

    Now I've learned three ways : 1. call js Jump 2.header() Jump 3. call HTML Method realization Because I have been learning by myself and have not entered the project , I don't know which one is used more often . call js Jump . <?php // Here's the jump method ...

Random recommendation

  1. SqlIO Optimize

    1SqlIO Optimize set statistics io on--sqlset statistics io off 2Sql Occupy CPU Time select c.total_worker_time, c.la ...

  2. Ajax in return false Invalid How to solve ?

    var flag=0; $.ajax({ url:"widget?type=member_register&ajax=yes&action=checkname&use ...

  3. SmartWiki Introduction to online document management system

    brief introduction SmartWiki It's about IT Easy to use document management system developed by the team . Can be used to store daily interface documents , Database dictionary , Manual instructions and other documents . Built in project management , User management , Authority management and other functions , It can meet the document management needs of most small and medium-sized teams ...

  4. Using newInstance() to Instantiate a Fragment( turn )

    I recently came across an interesting question on StackOverflow regarding Fragment instantiation: Wh ...

  5. fsck Repair ext3 file system ( be used for linux The system time is wrong , The file system information is wrong die with exit status And so on )

    Sometimes we use virtual machines to install linux, But our developers , The system time may have been adjusted for some special requirements ( For example, keep some special software up to date , Need to lock time and so on ), such linux It's been a long time since our system started , If time is not right , Can cause ext ...

  6. MyBatis Simple addition, deletion, modification and query as well as simple paging query implementation

    MyBatis Simple addition, deletion, modification and query as well as simple paging query implementation <? xml version="1.0" encoding="UTF-8"? > <!DO ...

  7. word2vec c Code instructions

    Abstract : 1 participle The text corpus is divided into words , With spaces ,tab It's all right . The corpus after word segmentation is generated 2 Training On the corpus after segmentation test.txt  Training to get model files vectors.bin /word2vec -train ...

  8. Logback How to customize flexible log filtering rules in

    When we need to do some scope control over the printing of logs , It's usually done for each Appender Set up different Filter Configuration to achieve . stay Logback Two filters are included in the implementation :ch.qos.logback.classic ...

  9. stay Centos below FTP Mapping scheme

    Two days ago, the company was on one Centos On the machine , Backup some files to another computer regularly ftp Server , stay Linux In the system ,mount It doesn't support hanging directly on "ftp://192.168.1.1/backup&quo ...

  10. spring cloud The way (1)

    1. Each function springcloud Registry Center Eureka Load balancing Ribbon Routing Gateway Zuul Circuit breaker Hystrix Distributed configuration config Service call tracing sleuth Log output elk Authentication Integration ...