Skip to content

Instantly share code, notes, and snippets.

//
// Endpoint.swift
//
// Created by ben
// Copyright © 2017年 popochess. All rights reserved.
//
import UIKit
import Alamofire
NSMutableArray *list = [NSMutableArray array];
[list addObject:[NSNumber numberWithDouble:7.92]];
[list addObject:@{@"my_key":@"my_value"}];
[list addObject:@"test string"];
[NSURLConnection sendAsynchronousRequest:request
queue:[NSOperationQueue mainQueue]
completionHandler:^(NSURLResponse *response, NSData *data, NSError *error)
{
//do something you want
}
}];
- (void)goSecondView
{
NavSecondController *secondView = [[NavSecondController alloc] initWithNibName:@"NavSecondController" bundle:nil];
[secondView setTitle:@"Second View"];
[self.navigationController pushViewController:secondView animated:YES];
}
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button addTarget:self action:@selector(goSecondView) forControlEvents:UIControlEventTouchDown];
[button setTitle:@"Second View" forState:UIControlStateNormal];
button.frame = CGRectMake(110, 150, 100.0, 40.0);
[self.view addSubview:button];
//Create a ViewController
NavRootViewController *navViewController = [[NavRootViewController alloc] initWithNibName:@"NavRootViewController" bundle: nil];
//Use navRootViewController as its root Controller
UINavigationController *rootController = [[UINavigationController alloc] initWithRootViewController:navViewController];
//set the navigation bar title
[navViewController setTitle:@"Root View"];
self.window.rootViewController = rootController;
//Create a ViewController
NavRootViewController *navViewController = [[NavRootViewController alloc] initWithNibName:@"NavRootViewController" bundle: nil];
//Use navRootViewController as its root Controller
UINavigationController *rootController = [[UINavigationController alloc] initWithRootViewController:navViewController];
//set the navigation bar title
[navViewController setTitle:@"Root View"];
self.window.rootViewController = rootController;