初始化导航长长的

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    // Override point for customization after application launch.
    self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
    UINavigationController *nav = [[[UINavigationController alloc] initWithRootViewController:self.viewController] autorelease];
    nav.navigationBar.barStyle = UIBarStyleBlack;
    self.window.rootViewController = nav;
    [self.window makeKeyAndVisible];
    return YES;
}
//该片段来自于http://outofmemory.cn

return

self .dismiss(animated: true, completion: nil)

button.frame = VCCGRect(x: 0, y: 0, width: 40, height: 40)

button.setImage(UIImage.init(named: “YXCommonBack”), for: .normal)

导航栏返回按钮的装 放到每个跟控制器 去操作 

}

UIApplication.shared.statusBarStyle = .lightContent

self.view.backgroundColor = VCBaseViewColor()

return

button.contentHorizontalAlignment =
UIControlContentHorizontalAlignment(rawValue: 1)!

}

func navigationDismiss(){

button.addTarget(self, action: #selector(navigationDismiss), for:
.touchUpInside)

override func viewDidLoad() {

if self.navigationController?.viewControllers.count == 1 &&
(self.navigationController?.viewControllers.last? .isEqual(self))! {

if self.navigationController == nil {

let leftItem =  UIBarButtonItem(customView: button)

self.navigationItem.leftBarButtonItem = leftItem

super.viewDidLoad()

}

UINavigationBar.appearance().titleTextAttributes =
[NSForegroundColorAttributeName:UIColor.white,NSFontAttributeName:
UIFont .boldSystemFont(ofSize: 17)]

self.dismiss(animated: true, completion: nil)

//其实是产生返回值的

}

_ = navigationController?.popViewController(animated: true)

let button = UIButton.init(type: .custom)

UINavigationBar.appearance().barTintColor = VCRGBColor(r: 18, g: 19, b:
20, a: 1);

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图