iOS 自定义NavigationBar右侧按钮rightBarButtonItem
自定义右侧的一个按钮
UIBarButtonItem *myButton = [[UIBarButtonItem alloc] initWithTitle:@"主页" style:UIBarButtonItemStyleBordered target:self action:@selector(clickEvent)]; self.navigationItem.rightBarButtonItem = myButton;
自定义右侧多个按钮
//两个按钮的父类view UIView *rightButtonView = [[UIView alloc] initWithFrame:CGRectMake(, , , )]; //历史浏览按钮 UIButton *historyBtn = [[UIButton alloc] initWithFrame:CGRectMake(, , , )]; [rightButtonView addSubview:historyBtn]; [historyBtn setImage:[UIImage imageNamed:@"button_history"] forState:UIControlStateNormal]; [historyBtn addTarget:self action:@selector(historyBtnEvent) forControlEvents:UIControlEventTouchUpInside]; #pragma mark >>>>>主页搜索按钮 //主页搜索按钮 UIButton *mainAndSearchBtn = [[UIButton alloc] initWithFrame:CGRectMake(, , , )]; [rightButtonView addSubview:mainAndSearchBtn]; [mainAndSearchBtn setImage:[UIImage imageNamed:@"button_filter-"] forState:UIControlStateNormal]; [mainAndSearchBtn addTarget:self action:@selector(mainAndSearchBtnEvent) forControlEvents:UIControlEventTouchUpInside]; //把右侧的两个按钮添加到rightBarButtonItem UIBarButtonItem *rightCunstomButtonView = [[UIBarButtonItem alloc] initWithCustomView:rightButtonView]; self.navigationItem.rightBarButtonItem = rightCunstomButtonView;
转自:https://www.jianshu.com/p/901203a8a90e
iOS 自定义NavigationBar右侧按钮rightBarButtonItem的更多相关文章
- iOS 自定义NavigationBar右侧按钮rightBarButtonItem--button
//两个按钮的父类view UIView *rightButtonView = [[UIView alloc] initWithFrame:CGRectMake(, , , )]; //历史浏览按钮 ...
- iOS自定义的UISwitch按钮
UISwitch开关控件 开关代替了点选框.开关是到目前为止用起来最简单的控件,不过仍然可以作一定程度的定制化. 一.创建 UISwitch* mySwitch = [[ UISwitchalloc] ...
- iOS自定义NavigationBar
日常开发中少不了用到UINavigationController,但是很多情况都要自定义NavigationBar.依稀记得自己刚开始也踩了好多坑,凑今天有空,就把想到的写下来.有时间了,考虑再把自定 ...
- 修改navigationbar右侧按钮离屏幕边缘位置
先上代码 UIButton *settingBtn = [Utils creatCustomButtonWithFrame:CGRectMake(, , , ) btnTitle: titleColo ...
- iOS 自定义UINavigationController返回按钮
主要代码如下: //自定义导航栏返回按钮 self.navigationItem.leftBarButtonItem = ({ //导航栏返回背景视图 UIView *view = [[UIView ...
- ios 自定义NavgationBar的按钮
UIImage *btnimage = [UIImage imageNamed:@"about.png"]; UIButton *btn = [[UIButton alloc] i ...
- [iOS微博项目 - 1.5] - NavigationBar标题按钮
A.NavigationBar标题按钮 1.需求 在“首页”的导航栏中部设置一个“首页”文字+箭头按钮 统一设置样式 根据实际文本长度调整宽度 消除系统自带的点击高亮效果 点击按钮,箭头上下颠倒 gi ...
- iOS 如何自定义NavigationBar的高度
UINavigationBar的高度在苹果官方的SDK中是固定的44个点,但是实际项目中我们却有可能遇到这样的情况,如下图: 这样的一个UINavigationBar的高度达到了84个点,这就需要我们 ...
- iOS 自定义导航栏笔记
一.UINavigationBar的结构 导航栏几乎是每个页面都会碰到的问题,一般两种处理方式:1.隐藏掉不显示 2.自定义 1. 添加导航栏 TestViewController * mainVC ...
随机推荐
- HDP-2.6.0.3
http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.6.0.3/HDP-2.6.0.3-centos6-rpm.tar.gz ...
- java:JSP(JSPWeb.xml的配置,动态和静态导入JSP文件,重定项和请求转发,使用JSP实现数据库的增删改查实例)
1.JSP的配置: <%@ page language="java" import="java.util.*" pageEncoding="UT ...
- line-height 与 height 的区别
line-height是行高的意思,它决定了元素中文本内容的高度,height则是定义元素自身的高度. height:表示 行高 line-height:表示 每行文字所占的高度 举例: 第 ...
- C++中sort函数使用方法
一.sort函数 1.sort函数包含在头文件为#include<algorithm>的c++标准库中,调用标准库里的排序方法可以实现对数据的排序,但是sort函数是如何实现的,我们不用考 ...
- C语言循环队列
#include<stdio.h> #include<stdlib.h> #include<string.h> //循环队列 typedef struct { in ...
- mysql——多表——子查询——示例
子查询: 子查询是将一个查询语句嵌套在另外一个查询语句中,内层查询语句的查询结果,可以作为外来层查询语句提供查询条件. 因此在特定条件下,一个查询语句的条件,需要另外一个查询语句来获取. 前期准备表: ...
- python 并发编程 多线程 Thread对象的其他属性或方法
介绍 Thread实例对象的方法 # isAlive(): 返回线程是否活动的. # getName(): 返回线程名. # setName(): 设置线程名. threading模块提供的一些方法: ...
- HDU 1171 Big Event in HDU (动态规划、01背包)
Big Event in HDU Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others ...
- Python新手练手项目
1.新手练手项目集中推荐 https://zhuanlan.zhihu.com/p/22164270 2.Python学习网站 https://www.shiyanlou.com 3.数据结构可视化学 ...
- 阿里云安装filezilla
1.连接服务器 ssh 或者 远程连接 到服务器: 2.安装相应软件 安装EPEL,EPEL是yum的一个软件源,里面包含了许多基本源里没有的软件: yum -y install epel-relea ...