标签:
UIImage *image=[UIImage imageNamed:@"ReturnHome_Dark"]; UIBarButtonItem* backButton=[[UIBarButtonItem alloc] initWithImage:image landscapeImagePhone:image style:UIBarButtonItemStylePlain target:self action:@selector(doBack:)]; self.navigationItem.leftBarButtonItem= backButton;
UIImage* img=[UIImage imageNamed:@"ReturnHome_Dark"]; UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; btn.frame =CGRectMake(0, 0, 20, 20); [btn setBackgroundImage:img forState:UIControlStateNormal]; [btn addTarget: self action: @selector(doBack:) forControlEvents: UIControlEventTouchUpInside]; UIBarButtonItem* item=[[UIBarButtonItem alloc]initWithCustomView:btn]; self.navigationItem.leftBarButtonItem=item;
UIButton * btn=[[UIButton alloc] initWithFrame:CGRectMake(0, 0, 100, 44)]; [btn addTarget:self action:@selector(doBack:) forControlEvents:UIControlEventTouchUpInside]; [btn setBackgroundColor:[UIColor clearColor]]; [self.navigationController.navigationBar addSubview:btn];
版权声明:本文为博主原创文章,未经博主允许不得转载。
NavigationItem.leftBarButtonItem 返回事件捕获
标签:
原文地址:http://blog.csdn.net/liuyinghui523/article/details/48130973