【学习笔记】AB调方法
来源:互联网 发布:电脑数据丢失怎么办 编辑:程序博客网 时间:2024/05/24 05:19
//
// AViewController.h
#import <UIKit/UIKit.h>
#import "BViewController.h"
@interface AViewController :UIViewController
-(void)turntoB;//方法全局,用来传
@end
// AViewController.m
#import "AViewController.h"
#import "BViewController.h"
@interface AViewController ()
@end
@implementation AViewController
- (void)viewDidLoad {
[superviewDidLoad];
//button,点击方法turntoB,传给B视图的button用
UIButton*button=[[UIButtonalloc]initWithFrame:CGRectMake(111,111, 111, 111)];
button.backgroundColor=[UIColorredColor];
[button addTarget:selfaction:@selector(turntoB)forControlEvents:UIControlEventTouchUpInside];
[self.viewaddSubview:button];
}
//方法
-(void)turntoB
{
NSLog(@"22222222");
}
@end
//
// BViewController.h
#import <UIKit/UIKit.h>
#import "AViewController.h" //用A的方法
@interface BViewController :UIViewController
@end
//
// BViewController.m
#import "BViewController.h"
@interface BViewController ()
@end
@implementation BViewController
- (void)viewDidLoad {
[superviewDidLoad];
//B的button,方法printB,
UIButton*button=[[UIButtonalloc]initWithFrame:CGRectMake(111,111, 111, 111)];
button.backgroundColor=[UIColorredColor];
[button addTarget:selfaction:@selector(printB)forControlEvents:UIControlEventTouchUpInside];
[self.viewaddSubview:button];
}
//printB调用A视图的turntoB的方法,,,,,关键
-(void)printB
{
AViewController*view=[[AViewControlleralloc]init];
[viewturntoB];
}
@end
- 【学习笔记】AB调方法
- 【学习笔记】AB传
- G.729AB学习笔记
- linux0.11学习笔记-技术铺垫-简单AB任务切换程序(3)-调试手段和方法
- linux0.11学习笔记-技术铺垫-简单AB任务切换程序(5)-实现三个任务切换
- 【学习笔记】系列八:Web性能压力测试工具之ApacheBench(ab)详解
- apache ab压力测试学习
- ab和LoadRunner的区别,及ab的运用方法
- ab.
- ab
- ab
- ab
- ab
- ab
- ab
- ab
- AttachEventHandler 方法学习笔记
- GetHashCode方法学习笔记
- 23种设计模式之单例模式
- Qt在写多窗口时的问题
- 红黑树描述
- 解决eclipse中出现Resource is out of sync with the file system问题
- finally问题
- 【学习笔记】AB调方法
- php设计模式学习记录(下)
- 23种设计模式之工厂方法模式
- hud.1017 A Mathematical Curiosity
- 链路层学习笔记
- 2015NCHU第一届ACM新生选拔赛E题题解
- 23种设计模式之抽象工厂模式
- 《CSDN Markdown简明教程》课程上线!
- 炮弹准确打击的计算方法