@implementation BViewController
@synthesize mswitch;
@synthesize mbt;
@synthesize lb;
@synthesize xbt;
-(IBAction) myAction:(id)sender{
//mbt.titleLabel.text = @"AAA";
UIView *v = (UIView*)sender;
if (v.tag == 1000) {
UIButton *bt = (UIButton*) sender;
[bt setTitle:@"中国" forState:FALSE]; //forestate 值为true或为false
NSLog(@"tag =1000");
NSLog(@"bt titleis:%@",bt.titleLabel.text);
}else if (v.tag == 2000) {
UISwitch *st = (UISwitch*)sender;
if ([st isOn]) {
NSLog(@"st is on");
}else{
NSLog(@"st is off");
}
}
lb.text = @"LBBBB";
//mtag = lb.tag;
}
/*
// The designated initializer. Override to perform setup that is required before the view is loaded.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
*/
// Implement loadView to create a view hierarchy programmatically, without using a nib.
//- (void)loadView {
//
//
//
//}
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[xbt addTarget:self action:@selector(myAction:) forControlEvents:UIControlEventTouchDown];
[super viewDidLoad];
}
@synthesize mswitch;
@synthesize mbt;
@synthesize lb;
@synthesize xbt;
-(IBAction) myAction:(id)sender{
//mbt.titleLabel.text = @"AAA";
UIView *v = (UIView*)sender;
if (v.tag == 1000) {
UIButton *bt = (UIButton*) sender;
[bt setTitle:@"中国" forState:FALSE]; //forestate 值为true或为false
NSLog(@"tag =1000");
NSLog(@"bt titleis:%@",bt.titleLabel.text);
}else if (v.tag == 2000) {
UISwitch *st = (UISwitch*)sender;
if ([st isOn]) {
NSLog(@"st is on");
}else{
NSLog(@"st is off");
}
}
lb.text = @"LBBBB";
//mtag = lb.tag;
}
/*
// The designated initializer. Override to perform setup that is required before the view is loaded.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
*/
// Implement loadView to create a view hierarchy programmatically, without using a nib.
//- (void)loadView {
//
//
//
//}
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[xbt addTarget:self action:@selector(myAction:) forControlEvents:UIControlEventTouchDown];
[super viewDidLoad];
}