IOS_20 _ Follow-up switching of Weibo Dock, ios_20 Weibo dock

Source: Internet
Author: User

IOS_20 _ Follow-up switching of Weibo Dock, ios_20 Weibo dock

Eventually: the Dock is switched along with HomeVC




Requirements:

When you click a line in the Weibo list in HomeVC,

Push to StatusDetail Weibo details controller, and the Dock disappears together

When you click the return button on the left of the StatusDetail Weibo details controller, the Dock also comes back with HomeVC.


HomeVC. m

// Click a microblog in the list, create a StatusDetailViewController, assign a value to its member status (data source), and push the stack to tableView (UITableView *) through the navigation bar *) tableView didSelectRowAtIndexPath :( NSIndexPath *) indexPath {// create a Weibo body details controller, StatusDetailViewController * detailVC = [[StatusDetailViewController alloc] init]; // It is the Weibo body controller to be redirected, pass weibo data (for display) StatusListCellFrame * statusListCellFrame = _ statusCellFrames [indexPath. row]; detailVC. status = statusListCellFrame. status; // jump to the past using the navigation controller [self. navigationController pushViewController: detailVC animated: YES];}




As shown in,

The view of the master controller (BeyondVC) consists of two parts:

1. Navigation controller 2 in the upper part and the Dock below




The view of the navigation controller in the upper part includes two parts:

1. navigation bar in the upper part (it will never move during push)

2. The root controller (HomeVC) in the lower part (animation switching will be performed during push)







In order to make the root control (HomeVC) of the Dock and navigation controller slide back together,

BeyondVC must be the proxy of the navigation controller,

The willShowViewController and didShowViewController methods enable listening for push actions




In the following willShowViewController method,

Remove the Dock from the master controller (BeyondVC) and add it to the root control (HomeVC) of the navigation controller.



Proxy method of navigation controller willShowViewController


# Pragma mark-proxy method of the navigation controller // screen width 320 # define kWinWidth self. view. bounds. width // screen height 480 # define kWinHeight self. view. bounds. height // top Status Bar 20 # define kStatusBarHeight 20 // The purpose is to listen for the push action. When the new controller enters the top of the stack, set the left button as the return arrow, set the right button to return to the home page-(void) navigationController :( UINavigationController *) navigationController willShowViewController :( UIViewController *) viewController animated :( BOOL) animated {// important ~~~~ // Obtain the root controller UIViewController * rootVC = navigationController first. viewControllers [0]; // if the Controller to be displayed (which will be pushed to the stack) is not the underlying controller (root Controller), you must set the return button on the left, the homepage button on the right is if (viewController! = RootVC) {// return to the previous controller viewController on the left. navigationItem. leftBarButtonItem = [UIBarButtonItem barButtonItemWithBgIcon: @ "navigationbar_back.png" target: self action: @ selector (poptopreviusvc)]; // return to the home page on the right, return to the stack controller (that is, back to the list page from the details page) viewController. navigationItem. rightBarButtonItem = [UIBarButtonItem barButtonItemWithBgIcon: @ "navigationbar_home.png" target: self action: @ selector (backToRootVC)]; // 1, first, stretch the view height of the navigation controller to the height of the entire window-20 (because after the dock disappears, there will be more black space at the bottom) navigationController. view. frame = CGRectMake (0, 20,320,480-20); // 2. First, let the Dock remove [_ dock removeFromSuperview] From the view of the master controller (BeyondViewController); // 3, to Push the next controller and let the dock and the root controller translate together, add the dock to the view of the root controller of the navigation controller, and re-adjust the Y value of the Dock in the HomeVC view. Note that the navigation will not move. The root controller of the navigation will be moved, and the root controller's origin (0 0) is: 20 + Navigation Bar Height 44 // if the root controller can scroll, note that the origin of y is on the top of tableView (after a certain distance is rolled down) if ([rootVC. view isKindOfClass: [UIScrollView class]) {UIScrollView * scrollV = (UIScrollView *) rootVC. view; // The y value in the root controller of the navigation controller of the dock. // After scrolling, the upper left corner of the rootView is far from the top. frame = CGRectMake (0, scrollV. contentOffset. y + 460-kDockHeight, 320, kDockHeight);} else {// y value _ dock in the root controller of the navigation controller of the dock. frame = CGRectMake (0,480-20-2 * kDockHeight, 320, kDockHeight);} // 4, finally, add the dock to the root controller of the navigation controller (on the rootVC interface (that is, the root controller of the navigation Controller) to push the new VC, let the dock and the navigation controller's root controller translate to the left of the interface. When the return key is clicked, the dock can return with rootVC again. view addSubview: _ dock] ;}}




In the following didShowViewController method,

Remove the Dock from the root control (HomeVC) of the navigation controller and add it to the master controller (BeyondVC ).




Proxy method of navigation controller didShowViewController

// Y = 20 for the navigation controller, and the height of the navigation controller = total height-DOCK height-20 # define kContentFrame CGRectMake (0, 20, self. view. frame. size. width, self. view. frame. size. height-kDockHeight-20) // In the BeyondVC master controller, Y of the DOCK = total height-DOCK height # define KDockFrame CGRectMake (0, self. view. frame. size. height-kDockHeight, self. view. frame. size. width, kDockHeight) // The purpose is to listen to the push action. When the new controller is displayed, remove the dock from the navigation controller and re-display it to the master controller-(void) navigationController :( UINavigationController *) navigationController didShowViewController :( UIViewController *) viewController animated :( BOOL) animated {// obtain the root controller UIViewController * rootVC = navigationController at the bottom of the stack. viewControllers [0]; // if the Controller to be displayed is the root controller, restart the Dock if (viewController = rootVC) {// modify the frame of the navigation controller view // Y of the navigation controller = 20, and the height of the navigation controller = total height-DOCK height-20 navigationController. view. frame = kContentFrame; // remove the [_ Dock removeFromSuperview] From the root controller rootVC at the bottom of the stack; // Add the dock to BeyondViewController, Y = total height-DOCK height _ DOCK. frame = KDockFrame; [self. view addSubview: _ dock] ;}}




In this way, let the Dock in the main controller follow the root controller of the navigation controller, disappear together, and return together ~



Activation code of the Dock plug-in ios

Activation code 04547672
Note: Activation in flight mode (WIFI disconnection)
Notice (important)
IPhone:
1. Enter the registration code in flight mode.
2. If you are prompted to register the software after activation and restart, enable the flight mode before shutdown. In this way, verification cannot be performed during startup, and you can continue to use it.
IPad:
If you use the Wi-Fi version, disable the wireless LAN (that is, wifi) and enter the registration code.
If the version is 3G + wifi, enter the registration code in flight mode and follow the steps above.
IPod touch is the same as iPad (wifi.
If the iPad is activated, contact us.

Can I find the replacement address in the dock bar of iOS 7?

Do you think you can modify it without jailbreak? View Original post>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.