如何设置actionbar 返回图标 Extension图标

Swift实现自由调整图标按钮中的图标和文字位置(扩展UIButton)-ios7教程-手机开发-壹聚教程网Swift实现自由调整图标按钮中的图标和文字位置(扩展UIButton)
UIButton按钮是IOS开发中最常用的控件,作为IOS基础学习教程知识 ,初学者需要了解其基本定义和常用设置,以便在开发在熟练运用,下面我们就一起来了解一下扩展UIButton用法。
按钮UIButton是ios开发中最常见的控件之一,下面来介绍UIButton的详细内容,及开发中需要注意的问题。
UIButton简介:
&& 使用目标动作设计模式,target-action模式,3种回调的模式之一。
实现原理:
使用下面的方法封装,根据用户的点击移动等动作
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)创建按钮:
//构造器方法,调用该方法创建某个样式的按钮对象
+ (id)buttonWithType:(UIButtonType)buttonType
buttonType:按钮样式
UIButtonTypeCustom = 0, 自定义风格UIButtonTypeRoundedRect, 圆角矩形
UIButtonTypeDetailDisclosure, 蓝色小箭头按钮,主要做详细说明用
UIButtonTypeInfoLight, 亮色感叹号
UIButtonTypeInfoDark, 暗色感叹号
UIButtonTypeContactAdd, 十字加号按钮UIButtonTypeSystem ,系统默认样式,若使用此样式,在使用setImage时会显示异常
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
配置按钮标题
//获取按钮的标题文字,只读属性
@property(nonatomic, readonly, retain) UILabel *titleLabel,注意请勿直接使用titleLabel来修改title
//返回在某个状态下,按钮的标题文字
- (NSString *)titleForState:(UIControlState)state
state:控件状态
UIControlStateNormal&&&&&&&&&&&&&&& //常规状态显现
UIControlStateHighlighted&&&&&&&&&& //高亮状态显现
UIControlStateDisabled&&&&&&&&&&&&& //禁用的状态才会显现
UIControlStateSelected&&&&&&&&&&&&& //选中状态 UIControlStateApplication&&&&&&&&&&& //当应用程序标志时
UIControlStateReserved&&&&&&&&&&&&& //为内部框架预留,可以不管他
返回值:此状态下按钮的标题文字
NSString *title = [button titleForState:UIControlStateNormal];
//设置按钮在某个状态下的标题文字
- (void)setTitle:(NSString *)title
&&&&&&& forState:(UIControlState)state
[button setTitle:@&按钮& forState:UIControlStateNormal];&&&&&&&
//返回在某个状态下,按钮标题的富文本
- (NSAttributedString *)attributedTitleForState:(UIControlState)state
state:控件的状态
返回值:富文本
NSAttirbutedString 为富文本,详情参见NSAttirbutedString文档
NSAttributedString *attributedString = [button attributedTitleForState:UIControlStateNormal];
//设值按钮在某个状态下的富文本标题
- (void)setAttributedTitle:(NSAttributedString *)title
&&&&&&&&&&&&&&&&& forState:(UIControlState)state
//返回按钮在某个状态下的标题颜色
- (UIColor *)titleColorForState:(UIControlState)state
state:状态
返回值:颜色
UIColor *color = [button titleColorForState:UIControlStateNormal];
//设置按钮标题的颜色
- (void)setTitleColor:(UIColor *)color
&&&&&&&&&&&& forState:(UIControlState)state
color:颜色描述对象
state:状态
[button setTitleColor:[UIColor redColor] forState:UIControlStateNormal];&&&&&&&&&&&&
//返回某个状态下按钮标题的阴影颜色
- (UIColor *)titleShadowColorForState:(UIControlState)state
//设置某个状态下按钮标题的阴影颜色
- (void)setTitleShadowColor:(UIColor *)color
&&&&&&&&&&&&&&&&&& forState:(UIControlState)state
color:颜色描述对象
state:状态
[button setTitleShadowColor:[UIColor grayColor] forState:UIControlStateNormal];
//标题的阴影改变时,按钮是否高亮显示。默认为NO
@property(nonatomic) BOOL reversesTitleShadowWhenHighlighted
配置按钮演示
//按钮高亮的情况下,图像的颜色是否要加深一点。默认是YES
@property(nonatomic) BOOL adjustsImageWhenHighlighted
//按钮禁用的情况下,图像的颜色是否要加深一点。默认是YES
@property(nonatomic) BOOL adjustsImageWhenDisabled
//按下按钮是否会发光。默认是NO
@property(nonatomic) BOOL showsTouchWhenHighlighted
//返回按钮在某个状态下的背景图片
- (UIImage *)backgroundImageForState:(UIControlState)state
state:状态
返回值:背景图像
UIImage *image = [button backgroundImageForState:UIControlStateNormal];
//获取按钮的填充图片
- (UIImage *)imageForState:(UIControlState)state
//设置按钮的背景图片
- (void)setBackgroundImage:(UIImage *)image
&&&&&&&&&&&&&&&&& forState:(UIControlState)state
image:背景图片
state:状态
[button setBackgroundImage:image forState:UIControlStateNormal];
//设置按钮的填充图片
- (void)setImage:(UIImage *)image
&&&&&&& forState:(UIControlState)state
配置按钮边框效果
//设置按钮的内部内容(包含按钮图片和标题)离按钮边缘上下左右的距离。
@property(nonatomic) UIEdgeInsets contentEdgeInsets
CGFloat top, left, bottom,
四个值,分别是上左下右
//设置按钮的内部标题离按钮边缘上下左右的距离
@property(nonatomic) UIEdgeInsets titleEdgeInsets
//设置按钮的内部图片离按钮边缘上下左右的距离
@property(nonatomic) UIEdgeInsets imageEdgeInsets
获取按钮当前状态(只读)
//获取按钮状态,只读属性
@property(nonatomic, readonly) UIButtonType buttonType
//获取按钮当前标题,只读属性
@property(nonatomic, readonly, retain) NSString *currentTitle
//获取按钮当前的富文本标题
@property(nonatomic, readonly, retain) NSAttributedString *currentAttributedTitle
//获取当前标题的颜色
@property(nonatomic, readonly, retain) UIColor *currentTitleColor
//获取当前标题的阴影颜色
@property(nonatomic, readonly, retain) UIColor *currentTitleShadowColor
//获取当前按钮的图片
@property(nonatomic, readonly, retain) UIImage *currentImage
//获取当前按钮的背景图片
@property(nonatomic, readonly, retain) UIImage *currentBackgroundImage
//获取当前按钮的图片框对象
@property(nonatomic, readonly, retain) UIImageView *imageView
重写绘制行为
你可以通过子类化按钮来定制属于你自己的按钮类。在子类化的时候你可以重载下面这些方法,这些方法返回CGRect结构,指明了按钮每一组成部分的边界。
注意:不要直接调用这些方法, 这些方法是你写给系统调用的。
//指定背景边界
- (CGRect)backgroundRectForBounds:(CGRect)bounds
//指定内容边界
- (CGRect)contentRectForBounds:(CGRect)bounds
//指定文字标题边界
- (CGRect)titleRectForContentRect:(CGRect)contentRect
//指定按钮图像边界
- (CGRect)imageRectForContentRect:(CGRect)contentRect
- (CGRect)imageRectForContentRect:(CGRect)bounds{
&&&&&&& return CGRectMake(0.0, 0.0, 44, 44);
//给按钮添加点击事件
[button addTarget:self action:@or(action:) forControlEvents:UIControlEventTouchUpInside];
UIControlEventTouchDown&&&&&&&&&&&&&&&& // 单点触摸按下事件:用户点触屏幕,或者又有新手指落下的时候。
&&& UIControlEventTouchDownRepeat&&&&&& // 多点触摸按下事件,点触计数大于1:用户按下第二、三、或第四根手指的时候。
&&& UIControlEventTouchDragInside&&&&&& // 当一次触摸在控件窗口内拖动时。
&&& UIControlEventTouchDragOutside&&&&& // 当一次触摸在控件窗口之外拖动时。
&&& UIControlEventTouchDragEnter&&&&&&& // 当一次触摸从控件窗口之外拖动到内部时
&&& UIControlEventTouchDragExit&&&&&&&& // 当一次触摸从控件窗口内部拖动到外部时。
&&& UIControlEventTouchUpInside&&&&&&&& // 所有在控件之内触摸抬起事件
&&& UIControlEventTouchUpOutside&&&&&&& // 所有在控件之外触摸抬起事件(点触必须开始与控件内部才会发送通知)。
&&& UIControlEventTouchCancel&&&&&&&&&& //所有触摸取消事件,即一次触摸因为放上了太多手指而被取消,或者被上锁或者电话呼叫打断。
&&& UIControlEventValueChanged&&&&&&&&& // 当控件的值发生改变时,发送通知。用于滑块、分段控件、以及其他取值的控件。你可以配置滑块控件何时发送通知,在滑块被放下时发送,或者在被拖动时发送。
&&& UIControlEventEditingDidBegin&&&&&& // 当文本控件中开始编辑时发送通知
&&& UIControlEventEditingChanged&&&&&&& // 当文本控件中的文本被改变时发送通知。
&&& UIControlEventEditingDidEnd&&&&&&&& // 当文本控件中编辑结束时发送通知。
&&& UIControlEventEditingDidEndOnExit&& // 当文本控件内通过按下回车键(或等价行为)结束编辑时,发送通知。
&&& UIControlEventAllTouchEvents&&&&&&& // 通知所有触摸事件。
&&& UIControlEventAllEditingEvents&&&&& // 通知所有关于文本编辑的事件。
&&& UIControlEventApplicationReserved&& // range available for application use
&&& UIControlEventSystemReserved&&&&&&& // range reserved for internal framework use
&&& UIControlEventAllEvents&&&&&&&&&&&& // 通知所有事件
复选框checkBox的实现:
首先给选中,何不选中的时候设置背景图片
点击按钮的时候,取反selected值即可
利用selected状态,反选即可
示例代码:
-(void)Click:(UIButton *)btn
&&& btn.selected = !btn.
- (void)viewDidLoad {
UIButton *checkbox = [UIButton buttonWithType:UIButtonTypeCustom];
&&& CGRect checkboxRect = CGRectMake(135,150,36,36);
&&& [checkbox setFrame:checkboxRect];
&&& [checkbox setImage:[UIImage imageNamed:@&checkbox_off.png&] forState:UIControlStateNormal];
&&& [checkbox setImage:[UIImage imageNamed:@&checkbox_on.png&] forState:UIControlStateSelected];
&&& [checkbox addTarget:self action:@selector(checkboxClick:) forControlEvents:UIControlEventTouchUpInside];
&& [self.view addSubview:checkbox];&&&
自由调整图标按钮中的图标和文字位置(扩展UIButton)
1,Custom类型的UIButton
我们使用定制类型(Custom)的按钮就可以设置文字前面的图标。但是图片和文字的相对位置是固定的(按钮在前,文字在后)。
(1)我们用下面的左图(64*64)制作一个带图标的按钮
//创建一个图片加文字的按钮
let btn1:UIButton = UIButton(frame: CGRect(x: 50, y: 50, width: 180, height: 32))
btn1.setImage(UIImage(named: &alert&), forState: UIControlState.Normal) //按钮图标
btn1.titleLabel?.font = UIFont.boldSystemFontOfSize(28) //文字大小
btn1.setTitle(&带图标按钮&, forState: UIControlState.Normal) //按钮文字
btn1.setTitleColor(UIColor.orangeColor(), forState: UIControlState.Normal) //文字颜色
self.view.addSubview(btn1)
(2)图片与文字间的间距方式1 - 设置图片偏移量(imageEdgeInsets)
btn1.imageEdgeInsets = UIEdgeInsets(top: 0, left: -20, bottom: 0, right: 0)
(3)图片与文字间的间距方式2 - 设置文字偏移量(titleEdgeInsets)&
btn1.titleEdgeInsets= UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 0)
2,扩展UIButton
如果我们想要把文字和图片位置调换下(即文字在前、图片在后),或者文字和图片改成上下排列,那么同样通过设置 titleEdgeInsets 和 imageEdgeInsets 即可实现。
为方便快速的设置图片和文字的相对位置,以及间距,这里对UIButton进行扩展。
(1)扩展代码如下:
import UIKit
extension UIButton {
&&& @objc func set(image anImage: UIImage?, title: String,
&&&&&&& titlePosition: UIViewContentMode, additionalSpacing: CGFloat, state: UIControlState){
&&&&&&& self.imageView?.contentMode = .Center
&&&&&&& self.setImage(anImage, forState: state)
&&&&&&& positionLabelRespectToImage(title, position: titlePosition, spacing: additionalSpacing)
&&&&&&& self.titleLabel?.contentMode = .Center
&&&&&&& self.setTitle(title, forState: state)
&&& private func positionLabelRespectToImage(title: String, position: UIViewContentMode,
&&&&&&& spacing: CGFloat) {
&&&&&&& let imageSize = self.imageRectForContentRect(self.frame)
&&&&&&& let titleFont = self.titleLabel?.font!
&&&&&&& let titleSize = title.sizeWithAttributes([NSFontAttributeName: titleFont!])
&&&&&&& var titleInsets: UIEdgeInsets
&&&&&&& var imageInsets: UIEdgeInsets
&&&&&&& switch (position){
&&&&&&& case .Top:
&&&&&&&&&&& titleInsets = UIEdgeInsets(top: -(imageSize.height + titleSize.height + spacing),
&&&&&&&&&&&&&&& left: -(imageSize.width), bottom: 0, right: 0)
&&&&&&&&&&& imageInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: -titleSize.width)
&&&&&&& case .Bottom:
&&&&&&&&&&& titleInsets = UIEdgeInsets(top: (imageSize.height + titleSize.height + spacing),
&&&&&&&&&&&&&&& left: -(imageSize.width), bottom: 0, right: 0)
&&&&&&&&&&& imageInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: -titleSize.width)
&&&&&&& case .Left:
&&&&&&&&&&& titleInsets = UIEdgeInsets(top: 0, left: -(imageSize.width * 2), bottom: 0, right: 0)
&&&&&&&&&&& imageInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0,
&&&&&&&&&&&&&&& right: -(titleSize.width * 2 + spacing))
&&&&&&& case .Right:
&&&&&&&&&&& titleInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: -spacing)
&&&&&&&&&&& imageInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
&&&&&&& default:
&&&&&&&&&&& titleInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
&&&&&&&&&&& imageInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
&&&&&&& self.titleEdgeInsets = titleInsets
&&&&&&& self.imageEdgeInsets = imageInsets
(2)使用样例
import UIKit
class ViewController: UIViewController {
&&& override func viewDidLoad() {
&&&&&&& super.viewDidLoad()
&&&&&&& let btn1:UIButton = UIButton(frame: CGRect(x: 0, y: 0, width: 200, height: 32))
&&&&&&& btn1.center = CGPointMake(view.frame.size.width/2, 60)
&&&&&&& btn1.titleLabel?.font = UIFont.boldSystemFontOfSize(28) //文字大小
&&&&&&& btn1.setTitleColor(UIColor.orangeColor(), forState: UIControlState.Normal) //文字颜色
&&&&&&& btn1.set(image: UIImage(named: &alert&), title: &文字在左侧&, titlePosition: .Left,
&&&&&&&&&&& additionalSpacing: 10.0, state: .Normal)
&&&&&&& view.addSubview(btn1)
&&&&&&& let btn2:UIButton = UIButton(frame: CGRect(x: 0, y: 0, width: 200, height: 32))
&&&&&&& btn2.center = CGPointMake(view.frame.size.width/2, 120)
&&&&&&& btn2.titleLabel?.font = UIFont.boldSystemFontOfSize(28) //文字大小
&&&&&&& btn2.setTitleColor(UIColor.orangeColor(), forState: UIControlState.Normal) //文字颜色
&&&&&&& btn2.set(image: UIImage(named: &alert&), title: &文字在右侧&, titlePosition: .Right,
&&&&&&&&&&& additionalSpacing: 10.0, state: .Normal)
&&&&&&& view.addSubview(btn2)
&&&&&&& let btn3:UIButton = UIButton(frame: CGRect(x: 0, y: 0, width: 170, height: 70))
&&&&&&& btn3.center = CGPointMake(view.frame.size.width/2, 230)
&&&&&&& btn3.titleLabel?.font = UIFont.boldSystemFontOfSize(28) //文字大小
&&&&&&& btn3.setTitleColor(UIColor.orangeColor(), forState: UIControlState.Normal) //文字颜色
&&&&&&& btn3.set(image: UIImage(named: &alert&), title: &文字在上方&, titlePosition: .Top,
&&&&&&&&&&& additionalSpacing: 10.0, state: .Normal)
&&&&&&& view.addSubview(btn3)
&&&&&&& let btn4:UIButton = UIButton(frame: CGRect(x: 0, y: 0, width: 170, height: 70))
&&&&&&& btn4.center = CGPointMake(view.frame.size.width/2, 290)
&&&&&&& btn4.titleLabel?.font = UIFont.boldSystemFontOfSize(28) //文字大小
&&&&&&& btn4.setTitleColor(UIColor.orangeColor(), forState: UIControlState.Normal) //文字颜色
&&&&&&& btn4.set(image: UIImage(named: &alert&), title: &文字在下方&, titlePosition: .Bottom,
&&&&&&&&&&& additionalSpacing: 10.0, state: .Normal)
&&&&&&& view.addSubview(btn4)
&&& override func didReceiveMemoryWarning() {
&&&&&&& super.didReceiveMemoryWarning()
上一页: &&&&&下一页:相关内容Page Actions
使用page actions把图标放置到地址栏里。page actions定义需要处理的页面的事件,但是它们不是适用于所有页面的。下面是一些page actions的示例:
订阅该页面的RSS feed
为页面的图片做一个幻灯片
在下面的屏幕截图中的RSS图标,提供了一个可以让用户订阅当前页面RSS Feed的page action。
想让扩展图标总是可见,则使用。
注意: 打包的应用程序不能使用page actions。
中用下面的方式注册你的page action:
"name": "My extension",
"page_action": {
"default_icon": "icons/foo.png", // optional
"default_title": "Do action",
// shown in tooltip
"default_popup": "popup.html"
// optional
UI的组成部分
同browser actions一样,page actions
可以有图标、提示信息、 弹出窗口。但没有badge,也因此,作为辅助,page actions可以有显示和消失两种状态。阅读. 可以找到图标、提示信息、 弹出窗口相关信息。
可以显示和隐藏page action。缺省情况下page action是隐藏的。当要显示时,需要指定图标所在的标签页,图标显示后会一直可见,直到该标签页关闭或开始显示不同的URL (如:用户点击了一个连接)
为了获得最佳的视觉效果,请遵循下列指导方针:
要只对少数页面使用page action;
不要对大多数页面使用它,如果功能需要,使用 代替。
没事别总让图标出现动画,那会让人很烦。
你可以在 找到使用page action的简单示例,其它例子和源代码帮助查看。
API reference: chrome.pageAction
Properties
getLastError
chrome.extensionlastError
chrome.pageAction.hide(, integer
Undocumented.
隐藏page action.
Parameters
enumerated
Undocumented.
要执行这个动作的标签ID。
This parameter was added in version
You must omit this parameter in earlier versions,
and you may omit it in any version.
If you require this
parameter, the manifest key
can ensure that your extension won't be run in an earlier browser version.
Callback function
The callback parameter should specify a function
that looks like this:
If you specify the callback parameter, it should
specify a function that looks like this:
function(Type param1, Type param2) {...};
This function was added in version .
If you require this function, the manifest key
can ensure that your extension won't be run in an earlier browser version.
chrome.pageAction.setIcon(, object
Undocumented.
为page aciton设置图标。图标可以是一个图片的路径或者是从一个canvas元素提取的像素信息.。无论是图标路径还是canvas的 imageData,这个属性必须被指定。
Parameters
enumerated
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version
You must omit this parameter in earlier versions,
and you may omit it in any version.
If you require this
parameter, the manifest key
can ensure that your extension won't be run in an earlier browser version.
enumerated
Undocumented.
要执行这个动作的标签ID。
This parameter was added in version
You must omit this parameter in earlier versions,
and you may omit it in any version.
If you require this
parameter, the manifest key
can ensure that your extension won't be run in an earlier browser version.
enumerated
Undocumented.
图片的像素信息。必须是一个ImageData 对象(例如:一个canvas元素)。
This parameter was added in version
You must omit this parameter in earlier versions,
and you may omit it in any version.
If you require this
parameter, the manifest key
can ensure that your extension won't be run in an earlier browser version.
enumerated
Undocumented.
图片在扩展中的的相对路径。
This parameter was added in version
You must omit this parameter in earlier versions,
and you may omit it in any version.
If you require this
parameter, the manifest key
can ensure that your extension won't be run in an earlier browser version.
enumerated
Undocumented.
不建议。manifest中定义的,0开始的图标数组下标。
This parameter was added in version
You must omit this parameter in earlier versions,
and you may omit it in any version.
If you require this
parameter, the manifest key
can ensure that your extension won't be run in an earlier browser version.
Callback function
The callback parameter should specify a function
that looks like this:
If you specify the callback parameter, it should
specify a function that looks like this:
function(Type param1, Type param2) {...};
This function was added in version .
If you require this function, the manifest key
can ensure that your extension won't be run in an earlier browser version.
chrome.pageAction.setPopup(, object
Undocumented.
设置一个点击page actions时显示在popup中的HTML。
Parameters
enumerated
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version
You must omit this parameter in earlier versions,
and you may omit it in any version.
If you require this
parameter, the manifest key
can ensure that your extension won't be run in an earlier browser version.
enumerated
Undocumented.
要设置popup的标签ID。
This parameter was added in version
You must omit this parameter in earlier versions,
and you may omit it in any version.
If you require this
parameter, the manifest key
can ensure that your extension won't be run in an earlier browser version.
enumerated
Undocumented.
popup中显示的html文件。如果设置为空字符(''),将不显示popup。
This parameter was added in version
You must omit this parameter in earlier versions,
and you may omit it in any version.
If you require this
parameter, the manifest key
can ensure that your extension won't be run in an earlier browser version.
Callback function
The callback parameter should specify a function
that looks like this:
If you specify the callback parameter, it should
specify a function that looks like this:
function(Type param1, Type param2) {...};
这个功能已经在chromium 5.0.316.0版本添加。如果你需要这个功能,可以通过manifest的键值来确认你的扩展不会运行在早期的浏览器版本。
chrome.pageAction.setTitle(, object
Undocumented.
设置page action的标题,这将显示在tooltip中。
Parameters
enumerated
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version
You must omit this parameter in earlier versions,
and you may omit it in any version.
If you require this
parameter, the manifest key
can ensure that your extension won't be run in an earlier browser version.
enumerated
Undocumented.
要设置标题的标签ID。
enumerated
Undocumented.
提示信息字符串。
This parameter was added in version
You must omit this parameter in earlier versions,
and you may omit it in any version.
If you require this
parameter, the manifest key
can ensure that your extension won't be run in an earlier browser version.
Callback function
The callback parameter should specify a function
that looks like this:
If you specify the callback parameter, it should
specify a function that looks like this:
function(Type param1, Type param2) {...};
This function was added in version .
If you require this function, the manifest key
can ensure that your extension won't be run in an earlier browser version.
chrome.pageAction.show(, integer
Undocumented.
显示page action,无论标签是否被选中。
Parameters
enumerated
Undocumented.
要执行这个动作的标签ID。
This parameter was added in version
You must omit this parameter in earlier versions,
and you may omit it in any version.
If you require this
parameter, the manifest key
can ensure that your extension won't be run in an earlier browser version.
Callback function
The callback parameter should specify a function
that looks like this:
If you specify the callback parameter, it should
specify a function that looks like this:
function(Type param1, Type param2) {...};
This function was added in version .
If you require this function, the manifest key
can ensure that your extension won't be run in an earlier browser version.
chrome.pageAction.onClicked.addListener(function(Tab tab) {...});
Undocumented.
当page action图标被点击的时候调用,如果page action是一个popup,这个事件将不会触发。Fi
Parameters
enumerated
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version
You must omit this parameter in earlier versions,
and you may omit it in any version.
If you require this
parameter, the manifest key
can ensure that your extension won't be run in an earlier browser version.}

我要回帖

更多关于 ios action extension 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信