重写导航栏左按钮

重写导航栏左按钮,第1张

概述重写导航栏按钮

下面是内存溢出 jb51.cc 通过网络收集整理的代码片段。

内存溢出小编现在分享给大家,也给大家做个参考。

////  NextVIEwController.m//  HXAandind////  Created by xushuanghui on 15-3-23.//  copyright (c) 2015年 wxhl_zy16. All rights reserved.//#import "NextVIEwController.h"#import "VIEwController.h"@interface NextVIEwController ()@end@implementation NextVIEwController- (voID)vIEwDIDLoad {    [super vIEwDIDLoad];    // Do any additional setup after loading the vIEw.        self.vIEw.backgroundcolor = [UIcolor redcolor];        //设置返回按钮    UIbutton *button = [UIbutton buttonWithType:UIbuttonTypeCustom];    button.frame = CGRectMake(0,20,50,30);    button.backgroundcolor = [UIcolor orangecolor];    [button addTarget:self action:@selector(buttonAction) forControlEvents:UIControlEventtouchUpInsIDe];    UIbarbuttonItem *left = [[UIbarbuttonItem alloc] initWithCustomVIEw:button];    self.navigationItem.leftbarbuttonItem = left;    [button setTitle:@"Backd" forState:UIControlStatenormal];        //试图上添加手势    UISwipeGestureRecognizer *swio = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swioAction)];    swio.direction = UISwipeGestureRecognizerDirectionleft;    [self.vIEw addGestureRecognizer:swio];}//添加手势效果- (voID)swioAction{        CATransition *caTran = [[CATransition alloc] init];    caTran.duration = 2.0;    caTran.delegate  = self;    caTran.type = @"rippleEffect";    [self.navigationController.vIEw.layer addAnimation:caTran forKey:nil];    [self.navigationController popToRootVIEwControllerAnimated:YES];}//添加返回按钮效果- (voID)buttonAction{            CATransition *caTran = [[CATransition alloc] init];    caTran.duration = 2.0;    caTran.delegate  = self;    caTran.type = @"rippleEffect";    [self.navigationController.vIEw.layer addAnimation:caTran forKey:nil];    [self.navigationController popToRootVIEwControllerAnimated:YES];    }- (voID)dIDReceiveMemoryWarning {    [super dIDReceiveMemoryWarning];    // dispose of any resources that can be recreated.}/*#pragma mark - Navigation// In a storyboard-based application,you will often want to do a little preparation before navigation- (voID)prepareForSegue:(UIStoryboardSegue *)segue sender:(ID)sender {    // Get the new vIEw controller using [segue destinationVIEwController].    // Pass the selected object to the new vIEw controller.}*/@end

以上是内存溢出(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

总结

以上是内存溢出为你收集整理的重写导航栏左按钮全部内容,希望文章能够帮你解决重写导航栏左按钮所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1107850.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存