Category

在上一个工程中,New File,选择Objective-Category,基类型UILabel,名称ClickButton

//
//  UILabel+ClickButton.h
//  ClickButton
//
//  Created by cloud on 13-3-19.
//  Copyright (c) 2013年 cloud. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface UILabel (ClickButton)
-(void) setShowTitle:(NSString *)text;
@end

//
//  UILabel+ClickButton.m
//  ClickButton
//
//  Created by cloud on 13-3-19.
//  Copyright (c) 2013年 cloud. All rights reserved.
//

#import "UILabel+ClickButton.h"

@implementation UILabel (ClickButton)
-(void) setShowTitle:(NSString *)text
{
    self.text=[NSString stringWithFormat:@"你按下了%@键",text];
}
@end

UILabel中就多了一个新的方法:setShowTitle,修改ViewController.m文件。

//
//  ViewController.m
//  ClickButton
//
//  Created by cloud on 13-3-19.
//  Copyright (c) 2013年 cloud. All rights reserved.
//

#import "ViewController.h"
#import "UILabel+ClickButton.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)pressButton:(UIButton*)sender {
    //_lblInfo.text=[sender titleForState:UIControlStateNormal];
    [_lblInfo setShowTitle:[sender titleForState:UIControlStateNormal]];
}
- (void)dealloc {
    [_lblInfo release];
    [super dealloc];
}
@end

运行结果如下:


说明:category可以为类添加新的方法,但不能添加新的成员变量。

源码地址:点击打开链接

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <dcspecfile version="1.1"> <categorys> <category>POWER_OSD</category> <category>OS_PS</category> <category>OS_VDD</category> <category>OS_VSS</category> <category>IOZ_VDDH</category> <category>IOZ_VDDL</category> <category>VIHL_VDDH</category> <category>VIHL_VDDL</category> <category>VOHL_VDDL</category> <category>VOH_VDDL</category> <category>VOL_VDDL</category> <category>default</category> </categorys> <dcspectable> <dcspec name="Vcoef" comment=""> <category expression="1" category="POWER_OSD"/> <category expression="1" category="OS_PS"/> <category expression="1" category="OS_VDD"/> <category expression="1" category="OS_VSS"/> <category expression="1" category="IOZ_VDDH"/> <category expression="1" category="IOZ_VDDL"/> <category expression="1" category="VIHL_VDDH"/> <category expression="1" category="VIHL_VDDL"/> <category expression="1" category="VOHL_VDDL"/> <category expression="1" category="VOH_VDDL"/> <category expression="1" category="VOL_VDDL"/> <category expression="1" category="default"/> </dcspec> <dcspec name="Vcoef_IO" comment=""> <category expression="1" category="POWER_OSD"/> <category expression="1" category="OS_PS"/> <category expression="1" category="OS_VDD"/> <category expression="1" category="OS_VSS"/> <category expression="1.1" category="IOZ_VDDH"/> <category expression="0.9" category="IOZ_VDDL"/> <category expression="1.1" category="VIHL_VDDH"/> <category expression="0.9" category="VIHL_VDDL"/> <category expression="0.9" category="VOHL_VDDL"/> <category expression="0.9" category="VOH_VDDL"/> <category expression="0.9" category="VOL_VDDL"/> <category expression="1" category="default"/> </dcspec> <dcspec name="VDD" comment=""> <category expression="0.1" category="POWER_OSD"/> <category expression="0.1" category="OS_PS"/> <category expression="0" category="OS_VDD"/> <category expression="0" category="OS_VSS"/> <category expression="0.75" category="IOZ_VDDH"/> <category expression="0.75" category="IOZ_VDDL"/> <category expression="0.75" category="VIHL_VDDH"/> <category expression="0.75" category="VIHL_VDDL"/> <category expression="0.75" category="VOHL_VDDL"/> <category expression="0.75" category="VOH_VDDL"/> <category expression="0.75" category="VOL_VDDL"/> <category expression="0.75" category="default"/> </dcspec> <dcspec name="VDDC" comment=""> <category expression="0.1" category="POWER_OSD"/> <category expression="0.11" category="OS_PS"/> <category expression="0" category="OS_VDD"/> <category expression="0" category="OS_VSS"/> <category expression="0.75" category="IOZ_VDDH"/> <category expression="0.75" category="IOZ_VDDL"/> <category expression="0.75" category="VIHL_VDDH"/> <category expression="0.75" category="VIHL_VDDL"/> <category expression="0.75" category="VOHL_VDDL"/> <category expression="0.75" category="VOH_VDDL"/> <category expression="0.75" category="VOL_VDDL"/> <category expression="0.75" category="default"/> </dcspec> <dcspec name="DVDD18_IO" comment=""> <category expression="0.1" category="POWER_OSD"/> <category expression="0.12" category="OS_PS"/> <category expression="0" category="OS_VDD"/> <category expression="0" category="OS_VSS"/> <category expression="1.8" category="IOZ_VDDH"/> <category expression="1.8" category="IOZ_VDDL"/> <category expression="1.8" category="VIHL_VDDH"/> <category expression="1.8" category="VIHL_VDDL"/> <category expression="1.8" category="VOHL_VDDL"/> <category expression="1.8" category="VOH_VDDL"/> <category expression="1.8" category="VOL_VDDL"/> <category expression="1.8" category="default"/> </dcspec> <dcspec name="AVDD075_FNPLL" comment=""> <category expression="0.1" category="POWER_OSD"/> <category expression="0.13" category="OS_PS"/> <category expression="0" category="OS_VDD"/> <category expression="0" category="OS_VSS"/> <category expression="0.75" category="IOZ_VDDH"/> <category expression="0.75" category="IOZ_VDDL"/> <category expression="0.75" category="VIHL_VDDH"/> <category expression="0.75" category="VIHL_VDDL"/> <category expression="0.75" category="VOHL_VDDL"/> <category expression="0.75" category="VOH_VDDL"/> <category expression="0.75" category="VOL_VDDL"/> <category expression="0.75" category="default"/> </dcspec> <dcspec name="AVDD12_FNPLL" comment=""> <category expression="0.1" category="POWER_OSD"/> <category expression="0.14" category="OS_PS"/> <category expression="0" category="OS_VDD"/> <category expression="0" category="OS_VSS"/> <category expression="1.2" category="IOZ_VDDH"/> <category expression="1.2" category="IOZ_VDDL"/> <category expression="1.2" category="VIHL_VDDH"/> <category expression="1.2" category="VIHL_VDDL"/> <category expression="1.2" category="VOHL_VDDL"/> <category expression="1.2" category="VOH_VDDL"/> <category expression="1.2" category="VOL_VDDL"/> <category expression="1.2" category="default"/> </dcspec> <dcspec name="Vout_VDD" comment=""> <category expression="VDD*Vcoef" category="POWER_OSD"/> <category expression="VDD*Vcoef" category="OS_PS"/> <category expression="VDD*Vcoef" category="OS_VDD"/> <category expression="VDD*Vcoef" category="OS_VSS"/> <category expression="VDD*Vcoef" category="IOZ_VDDH"/> <category expression="VDD*Vcoef" category="IOZ_VDDL"/> <category expression="VDD*Vcoef" category="VIHL_VDDH"/> <category expression="VDD*Vcoef" category="VIHL_VDDL"/> <category expression="VDD*Vcoef" category="VOHL_VDDL"/> <category expression="VDD*Vcoef" category="VOH_VDDL"/> <category expression="VDD*Vcoef" category="VOL_VDDL"/> <category expression="VDD*Vcoef" category="default"/> </dcspec> <dcspec name="Vout_VDDC" comment=""> <category expression="VDDC*Vcoef" category="POWER_OSD"/> <category expression="VDDC*Vcoef" category="OS_PS"/> <category expression="VDDC*Vcoef" category="OS_VDD"/> <category expression="VDDC*Vcoef" category="OS_VSS"/> <category expression="VDDC*Vcoef" category="IOZ_VDDH"/> <category expression="VDDC*Vcoef" category="IOZ_VDDL"/> <category expression="VDDC*Vcoef" category="VIHL_VDDH"/> <category expression="VDDC*Vcoef" category="VIHL_VDDL"/> <category expression="VDDC*Vcoef" category="VOHL_VDDL"/> <category expression="VDDC*Vcoef" category="VOH_VDDL"/> <category expression="VDDC*Vcoef" category="VOL_VDDL"/> <category expression="VDDC*Vcoef" category="default"/> </dcspec> <dcspec name="Vout_DVDD18_IO" comment=""> <category expression="DVDD18_IO*Vcoef" category="POWER_OSD"/> <category expression="DVDD18_IO*Vcoef" category="OS_PS"/> <category expression="DVDD18_IO*Vcoef" category="OS_VDD"/> <category expression="DVDD18_IO*Vcoef" category="OS_VSS"/> <category expression="DVDD18_IO*Vcoef*Vcoef_IO" category="IOZ_VDDH"/> <category expression="DVDD18_IO*Vcoef*Vcoef_IO" category="IOZ_VDDL"/> <category expression="DVDD18_IO*Vcoef*Vcoef_IO" category="VIHL_VDDH"/> <category expression="DVDD18_IO*Vcoef*Vcoef_IO" category="VIHL_VDDL"/> <category expression="DVDD18_IO*Vcoef*Vcoef_IO" category="VOHL_VDDL"/> <category expression="DVDD18_IO*Vcoef*Vcoef_IO" category="VOH_VDDL"/> <category expression="DVDD18_IO*Vcoef*Vcoef_IO" category="VOL_VDDL"/> <category expression="DVDD18_IO*Vcoef" category="default"/> </dcspec> <dcspec name="Vout_AVDD075_FNPLL" comment=""> <category expression="AVDD075_FNPLL*Vcoef" category="POWER_OSD"/> <category expression="AVDD075_FNPLL*Vcoef" category="OS_PS"/> <category expression="AVDD075_FNPLL*Vcoef" category="OS_VDD"/> <category expression="AVDD075_FNPLL*Vcoef" category="OS_VSS"/> <category expression="AVDD075_FNPLL*Vcoef" category="IOZ_VDDH"/> <category expression="AVDD075_FNPLL*Vcoef" category="IOZ_VDDL"/> <category expression="AVDD075_FNPLL*Vcoef" category="VIHL_VDDH"/> <category expression="AVDD075_FNPLL*Vcoef" category="VIHL_VDDL"/> <category expression="AVDD075_FNPLL*Vcoef" category="VOHL_VDDL"/> <category expression="AVDD075_FNPLL*Vcoef" category="VOH_VDDL"/> <category expression="AVDD075_FNPLL*Vcoef" category="VOL_VDDL"/> <category expression="AVDD075_FNPLL*Vcoef" category="default"/> </dcspec> <dcspec name="Vout_AVDD12_FNPLL" comment=""> <category expression="AVDD12_FNPLL*Vcoef" category="POWER_OSD"/> <category expression="AVDD12_FNPLL*Vcoef" category="OS_PS"/> <category expression="AVDD12_FNPLL*Vcoef" category="OS_VDD"/> <category expression="AVDD12_FNPLL*Vcoef" category="OS_VSS"/> <category expression="AVDD12_FNPLL*Vcoef" category="IOZ_VDDH"/> <category expression="AVDD12_FNPLL*Vcoef" category="IOZ_VDDL"/> <category expression="AVDD12_FNPLL*Vcoef" category="VIHL_VDDH"/> <category expression="AVDD12_FNPLL*Vcoef" category="VIHL_VDDL"/> <category expression="AVDD12_FNPLL*Vcoef" category="VOHL_VDDL"/> <category expression="AVDD12_FNPLL*Vcoef" category="VOH_VDDL"/> <category expression="AVDD12_FNPLL*Vcoef" category="VOL_VDDL"/> <category expression="AVDD12_FNPLL*Vcoef" category="default"/> </dcspec> <dcspec name="Iclamp_VDD" comment=""> <category expression="8A" category="POWER_OSD"/> <category expression="0.2" category="OS_PS"/> <category expression="0.2" category="OS_VDD"/> <category expression="0.2" category="OS_VSS"/> <category expression="30A" category="IOZ_VDDH"/> <category expression="30A" category="IOZ_VDDL"/> <category expression="30A" category="VIHL_VDDH"/> <category expression="30A" category="VIHL_VDDL"/> <category expression="30A" category="VOHL_VDDL"/> <category expression="30A" category="VOH_VDDL"/> <category expression="30A" category="VOL_VDDL"/> <category expression="30A" category="default"/> </dcspec> <dcspec name="Iclamp_VDDC" comment=""> <category expression="4A" category="POWER_OSD"/> <category expression="0.2" category="OS_PS"/> <category expression="0.2" category="OS_VDD"/> <category expression="0.2" category="OS_VSS"/> <category expression="15A" category="IOZ_VDDH"/> <category expression="15A" category="IOZ_VDDL"/> <category expression="15A" category="VIHL_VDDH"/> <category expression="15A" category="VIHL_VDDL"/> <category expression="15A" category="VOHL_VDDL"/> <category expression="15A" category="VOH_VDDL"/> <category expression="15A" category="VOL_VDDL"/> <category expression="15A" category="default"/> </dcspec> <dcspec name="Iclamp_DVDD18_IO" comment=""> <category expression="0.4" category="POWER_OSD"/> <category expression="0.4" category="OS_PS"/> <category expression="0.4" category="OS_VDD"/> <category expression="0.4" category="OS_VSS"/> <category expression="1A" category="IOZ_VDDH"/> <category expression="1A" category="IOZ_VDDL"/> <category expression="1A" category="VIHL_VDDH"/> <category expression="1A" category="VIHL_VDDL"/> <category expression="1A" category="VOHL_VDDL"/> <category expression="1A" category="VOH_VDDL"/> <category expression="1A" category="VOL_VDDL"/> <category expression="1A" category="default"/> </dcspec> <dcspec name="Iclamp_AVDD075_FNPLL" comment=""> <category expression="0.2" category="POWER_OSD"/> <category expression="0.2" category="OS_PS"/> <category expression="0.2" category="OS_VDD"/> <category expression="0.2" category="OS_VSS"/> <category expression="0.5A" category="IOZ_VDDH"/> <category expression="0.5A" category="IOZ_VDDL"/> <category expression="0.5A" category="VIHL_VDDH"/> <category expression="0.5A" category="VIHL_VDDL"/> <category expression="0.5A" category="VOHL_VDDL"/> <category expression="0.5A" category="VOH_VDDL"/> <category expression="0.5A" category="VOL_VDDL"/> <category expression="0.5A" category="default"/> </dcspec> <dcspec name="Iclamp_AVDD12_FNPLL" comment=""> <category expression="0.4" category="POWER_OSD"/> <category expression="0.4" category="OS_PS"/> <category expression="0.4" category="OS_VDD"/> <category expression="0.4" category="OS_VSS"/> <category expression="0.5A" category="IOZ_VDDH"/> <category expression="0.5A" category="IOZ_VDDL"/> <category expression="0.5A" category="VIHL_VDDH"/> <category expression="0.5A" category="VIHL_VDDL"/> <category expression="0.5A" category="VOHL_VDDL"/> <category expression="0.5A" category="VOH_VDDL"/> <category expression="0.5A" category="VOL_VDDL"/> <category expression="0.5A" category="default"/> </dcspec> <dcspec name="Setupdelay_VDD" comment=""> <category expression="1ms" category="POWER_OSD"/> <category expression="1ms" category="OS_PS"/> <category expression="1ms" category="OS_VDD"/> <category expression="1ms" category="OS_VSS"/> <category expression="1ms" category="IOZ_VDDH"/> <category expression="1ms" category="IOZ_VDDL"/> <category expression="1ms" category="VIHL_VDDH"/> <category expression="1ms" category="VIHL_VDDL"/> <category expression="1ms" category="VOHL_VDDL"/> <category expression="1ms" category="VOH_VDDL"/> <category expression="1ms" category="VOL_VDDL"/> <category expression="1ms" category="default"/> </dcspec> <dcspec name="Setupdelay_VDDC" comment=""> <category expression="1ms" category="POWER_OSD"/> <category expression="1ms" category="OS_PS"/> <category expression="1ms" category="OS_VDD"/> <category expression="1ms" category="OS_VSS"/> <category expression="1ms" category="IOZ_VDDH"/> <category expression="1ms" category="IOZ_VDDL"/> <category expression="1ms" category="VIHL_VDDH"/> <category expression="1ms" category="VIHL_VDDL"/> <category expression="1ms" category="VOHL_VDDL"/> <category expression="1ms" category="VOH_VDDL"/> <category expression="1ms" category="VOL_VDDL"/> <category expression="1ms" category="default"/> </dcspec> <dcspec name="Setupdelay_DVDD18_IO" comment=""> <category expression="9ms" category="POWER_OSD"/> <category expression="9ms" category="OS_PS"/> <category expression="9ms" category="OS_VDD"/> <category expression="9ms" category="OS_VSS"/> <category expression="9ms" category="IOZ_VDDH"/> <category expression="9ms" category="IOZ_VDDL"/> <category expression="9ms" category="VIHL_VDDH"/> <category expression="9ms" category="VIHL_VDDL"/> <category expression="9ms" category="VOHL_VDDL"/> <category expression="9ms" category="VOH_VDDL"/> <category expression="9ms" category="VOL_VDDL"/> <category expression="9ms" category="default"/> </dcspec> <dcspec name="Setupdelay_AVDD075_FNPLL" comment=""> <category expression="1ms" category="POWER_OSD"/> <category expression="1ms" category="OS_PS"/> <category expression="1ms" category="OS_VDD"/> <category expression="1ms" category="OS_VSS"/> <category expression="1ms" category="IOZ_VDDH"/> <category expression="1ms" category="IOZ_VDDL"/> <category expression="1ms" category="VIHL_VDDH"/> <category expression="1ms" category="VIHL_VDDL"/> <category expression="1ms" category="VOHL_VDDL"/> <category expression="1ms" category="VOH_VDDL"/> <category expression="1ms" category="VOL_VDDL"/> <category expression="1ms" category="default"/> </dcspec> <dcspec name="Setupdelay_AVDD12_FNPLL" comment=""> <category expression="5ms" category="POWER_OSD"/> <category expression="5ms" category="OS_PS"/> <category expression="5ms" category="OS_VDD"/> <category expression="5ms" category="OS_VSS"/> <category expression="5ms" category="IOZ_VDDH"/> <category expression="5ms" category="IOZ_VDDL"/> <category expression="5ms" category="VIHL_VDDH"/> <category expression="5ms" category="VIHL_VDDL"/> <category expression="5ms" category="VOHL_VDDL"/> <category expression="5ms" category="VOH_VDDL"/> <category expression="5ms" category="VOL_VDDL"/> <category expression="5ms" category="default"/> </dcspec> <dcspec name="Trise_VDD" comment=""> <category expression="2ms" category="POWER_OSD"/> <category expression="2ms" category="OS_PS"/> <category expression="2ms" category="OS_VDD"/> <category expression="2ms" category="OS_VSS"/> <category expression="2ms" category="IOZ_VDDH"/> <category expression="2ms" category="IOZ_VDDL"/> <category expression="2ms" category="VIHL_VDDH"/> <category expression="2ms" category="VIHL_VDDL"/> <category expression="2ms" category="VOHL_VDDL"/> <category expression="2ms" category="VOH_VDDL"/> <category expression="2ms" category="VOL_VDDL"/> <category expression="2ms" category="default"/> </dcspec> <dcspec name="Trise_VDDC" comment=""> <category expression="2ms" category="POWER_OSD"/> <category expression="2ms" category="OS_PS"/> <category expression="2ms" category="OS_VDD"/> <category expression="2ms" category="OS_VSS"/> <category expression="2ms" category="IOZ_VDDH"/> <category expression="2ms" category="IOZ_VDDL"/> <category expression="2ms" category="VIHL_VDDH"/> <category expression="2ms" category="VIHL_VDDL"/> <category expression="2ms" category="VOHL_VDDL"/> <category expression="2ms" category="VOH_VDDL"/> <category expression="2ms" category="VOL_VDDL"/> <category expression="2ms" category="default"/> </dcspec> <dcspec name="Trise_DVDD18_IO" comment=""> <category expression="1ms" category="POWER_OSD"/> <category expression="1ms" category="OS_PS"/> <category expression="1ms" category="OS_VDD"/> <category expression="1ms" category="OS_VSS"/> <category expression="1ms" category="IOZ_VDDH"/> <category expression="1ms" category="IOZ_VDDL"/> <category expression="1ms" category="VIHL_VDDH"/> <category expression="1ms" category="VIHL_VDDL"/> <category expression="1ms" category="VOHL_VDDL"/> <category expression="1ms" category="VOH_VDDL"/> <category expression="1ms" category="VOL_VDDL"/> <category expression="1ms" category="default"/> </dcspec> <dcspec name="Trise_AVDD075_FNPLL" comment=""> <category expression="2ms" category="POWER_OSD"/> <category expression="2ms" category="OS_PS"/> <category expression="2ms" category="OS_VDD"/> <category expression="2ms" category="OS_VSS"/> <category expression="2ms" category="IOZ_VDDH"/> <category expression="2ms" category="IOZ_VDDL"/> <category expression="2ms" category="VIHL_VDDH"/> <category expression="2ms" category="VIHL_VDDL"/> <category expression="2ms" category="VOHL_VDDL"/> <category expression="2ms" category="VOH_VDDL"/> <category expression="2ms" category="VOL_VDDL"/> <category expression="2ms" category="default"/> </dcspec> <dcspec name="Trise_AVDD12_FNPLL" comment=""> <category expression="2ms" category="POWER_OSD"/> <category expression="2ms" category="OS_PS"/> <category expression="2ms" category="OS_VDD"/> <category expression="2ms" category="OS_VSS"/> <category expression="2ms" category="IOZ_VDDH"/> <category expression="2ms" category="IOZ_VDDL"/> <category expression="2ms" category="VIHL_VDDH"/> <category expression="2ms" category="VIHL_VDDL"/> <category expression="2ms" category="VOHL_VDDL"/> <category expression="2ms" category="VOH_VDDL"/> <category expression="2ms" category="VOL_VDDL"/> <category expression="2ms" category="default"/> </dcspec> <dcspec name="Vil_gIO_Digital_All" comment=""> <category expression="0" category="POWER_OSD"/> <category expression="0" category="OS_PS"/> <category expression="0" category="OS_VDD"/> <category expression="0" category="OS_VSS"/> <category expression="0*DVDD18_IO*Vcoef*Vcoef_IO" category="IOZ_VDDH"/> <category expression="0*DVDD18_IO*Vcoef*Vcoef_IO" category="IOZ_VDDL"/> <category expression="0.35*DVDD18_IO*Vcoef*Vcoef_IO" category="VIHL_VDDH"/> <category expression="0.35*DVDD18_IO*Vcoef*Vcoef_IO" category="VIHL_VDDL"/> <category expression="0*DVDD18_IO*Vcoef*Vcoef_IO" category="VOHL_VDDL"/> <category expression="0*DVDD18_IO*Vcoef*Vcoef_IO" category="VOH_VDDL"/> <category expression="0*DVDD18_IO*Vcoef*Vcoef_IO" category="VOL_VDDL"/> <category expression="0*DVDD18_IO*Vcoef*Vcoef_IO" category="default"/> </dcspec> <dcspec name="Vih_gIO_Digital_All" comment=""> <category expression="0" category="POWER_OSD"/> <category expression="0" category="OS_PS"/> <category expression="0" category="OS_VDD"/> <category expression="0" category="OS_VSS"/> <category expression="1*DVDD18_IO*Vcoef*Vcoef_IO" category="IOZ_VDDH"/> <category expression="1*DVDD18_IO*Vcoef*Vcoef_IO" category="IOZ_VDDL"/> <category expression="0.65*DVDD18_IO*Vcoef*Vcoef_IO" category="VIHL_VDDH"/> <category expression="0.65*DVDD18_IO*Vcoef*Vcoef_IO" category="VIHL_VDDL"/> <category expression="1*DVDD18_IO*Vcoef*Vcoef_IO" category="VOHL_VDDL"/> <category expression="1*DVDD18_IO*Vcoef*Vcoef_IO" category="VOH_VDDL"/> <category expression="1*DVDD18_IO*Vcoef*Vcoef_IO" category="VOL_VDDL"/> <category expression="1*DVDD18_IO*Vcoef*Vcoef_IO" category="default"/> </dcspec> <dcspec name="Vol_gIO_Digital_All" comment=""> <category expression="0" category="POWER_OSD"/> <category expression="0" category="OS_PS"/> <category expression="0.05" category="OS_VDD"/> <category expression="-1" category="OS_VSS"/> <category expression="0.45" category="IOZ_VDDH"/> <category expression="0.45" category="IOZ_VDDL"/> <category expression="0.4*DVDD18_IO*Vcoef*Vcoef_IO" category="VIHL_VDDH"/> <category expression="0.4*DVDD18_IO*Vcoef*Vcoef_IO" category="VIHL_VDDL"/> <category expression="0.45" category="VOHL_VDDL"/> <category expression="0.4*DVDD18_IO*Vcoef*Vcoef_IO" category="VOH_VDDL"/> <category expression="0.45" category="VOL_VDDL"/> <category expression="0.4*DVDD18_IO*Vcoef*Vcoef_IO" category="default"/> </dcspec> <dcspec name="Voh_gIO_Digital_All" comment=""> <category expression="0" category="POWER_OSD"/> <category expression="0" category="OS_PS"/> <category expression="0.95" category="OS_VDD"/> <category expression="-0.05" category="OS_VSS"/> <category expression="DVDD18_IO*Vcoef*Vcoef_IO-0.45" category="IOZ_VDDH"/> <category expression="DVDD18_IO*Vcoef*Vcoef_IO-0.45" category="IOZ_VDDL"/> <category expression="0.6*DVDD18_IO*Vcoef*Vcoef_IO" category="VIHL_VDDH"/> <category expression="0.6*DVDD18_IO*Vcoef*Vcoef_IO" category="VIHL_VDDL"/> <category expression="DVDD18_IO*Vcoef*Vcoef_IO-0.45" category="VOHL_VDDL"/> <category expression="DVDD18_IO*Vcoef*Vcoef_IO-0.45" category="VOH_VDDL"/> <category expression="0.6*DVDD18_IO*Vcoef*Vcoef_IO" category="VOL_VDDL"/> <category expression="0.6*DVDD18_IO*Vcoef*Vcoef_IO" category="default"/> </dcspec> <dcspec name="Vt_gIO_Digital_All" comment=""> <category expression="0" category="POWER_OSD"/> <category expression="0" category="OS_PS"/> <category expression="1" category="OS_VDD"/> <category expression="-1.1" category="OS_VSS"/> <category expression="0.5*DVDD18_IO*Vcoef*Vcoef_IO" category="IOZ_VDDH"/> <category expression="0.5*DVDD18_IO*Vcoef*Vcoef_IO" category="IOZ_VDDL"/> <category expression="0.5*DVDD18_IO*Vcoef*Vcoef_IO" category="VIHL_VDDH"/> <category expression="0.5*DVDD18_IO*Vcoef*Vcoef_IO" category="VIHL_VDDL"/> <category expression="0.5*DVDD18_IO*Vcoef*Vcoef_IO" category="VOHL_VDDL"/> <category expression="0.5*DVDD18_IO*Vcoef*Vcoef_IO" category="VOH_VDDL"/> <category expression="0.5*DVDD18_IO*Vcoef*Vcoef_IO" category="VOL_VDDL"/> <category expression="0.5*DVDD18_IO*Vcoef*Vcoef_IO" category="default"/> </dcspec> <dcspec name="Iol_gIO_Digital_All" comment=""> <category expression="0" category="POWER_OSD"/> <category expression="0" category="OS_PS"/> <category expression="0.0008" category="OS_VDD"/> <category expression="0.6mA" category="OS_VSS"/> <category expression="3mA" category="IOZ_VDDH"/> <category expression="2mA" category="IOZ_VDDL"/> <category expression="2mA" category="VIHL_VDDH"/> <category expression="2mA" category="VIHL_VDDL"/> <category expression="2mA" category="VOHL_VDDL"/> <category expression="2mA" category="VOH_VDDL"/> <category expression="2mA" category="VOL_VDDL"/> <category expression="10mA" category="default"/> </dcspec> <dcspec name="Ioh_gIO_Digital_All" comment=""> <category expression="0" category="POWER_OSD"/> <category expression="0" category="OS_PS"/> <category expression="0.0008" category="OS_VDD"/> <category expression="0.6mA" category="OS_VSS"/> <category expression="3mA" category="IOZ_VDDH"/> <category expression="2mA" category="IOZ_VDDL"/> <category expression="2mA" category="VIHL_VDDH"/> <category expression="2mA" category="VIHL_VDDL"/> <category expression="2mA" category="VOHL_VDDL"/> <category expression="2mA" category="VOH_VDDL"/> <category expression="2mA" category="VOL_VDDL"/> <category expression="10mA" category="default"/> </dcspec> <dcspec name="Vch_gIO_Digital_All" comment=""> <category expression="1.5" category="POWER_OSD"/> <category expression="1.5" category="OS_PS"/> <category expression="1.5" category="OS_VDD"/> <category expression="1.5" category="OS_VSS"/> <category expression="0" category="IOZ_VDDH"/> <category expression="0" category="IOZ_VDDL"/> <category expression="0" category="VIHL_VDDH"/> <category expression="0" category="VIHL_VDDL"/> <category expression="0" category="VOHL_VDDL"/> <category expression="0" category="VOH_VDDL"/> <category expression="0" category="VOL_VDDL"/> <category expression="0" category="default"/> </dcspec> <dcspec name="Vcl_gIO_Digital_All" comment=""> <category expression="-1" category="POWER_OSD"/> <category expression="-1" category="OS_PS"/> <category expression="-1.5" category="OS_VDD"/> <category expression="-1.5" category="OS_VSS"/> <category expression="0" category="IOZ_VDDH"/> <category expression="0" category="IOZ_VDDL"/> <category expression="0" category="VIHL_VDDH"/> <category expression="0" category="VIHL_VDDL"/> <category expression="0" category="VOHL_VDDL"/> <category expression="0" category="VOH_VDDL"/> <category expression="0" category="VOL_VDDL"/> <category expression="0" category="default"/> </dcspec> </dcspectable> </dcspecfile> 使用python 转换上述xml 为excel, 其中categorys为行标题,在第一行,dcspectable中各dcspec 的name 为列标题,其中的category子项中的category值对应上述行标题,expression为值,我需要你转换计算expression的值,其中会有表达式,表达式中的变量对应dcspec name里category 对应的expression值,但是有些有电流或者电压的单位,计算时需要注意,我需要你输出一个计算后的excel
最新发布
08-27
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值