UI_Target/action 设计模式
来源:互联网 发布:cf数据异常什么原因 编辑:程序博客网 时间:2024/05/16 08:21
RootView.m 中
UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem]; button.frame = CGRectMake(100, 100, 100, 40); [button setTitle:@"Target" forState:UIControlStateNormal]; [self addSubview:button]; // addTarget:self.controller 原来是 self // 方法 RootViewButtonDidClicked 在 ViewController.m 里面实现 [button addTarget:self.controller action:@selector(RootViewButtonDidClicked:) forControlEvents:UIControlEventTouchUpInside];
RootView.h 中
设置属性
@property (nonatomic, assign)UIViewController *controller;
ViewController.m
// 点击事件- (void)RootViewButtonDidClicked:(UIButton *)sender{ NSLog(@"hello");}- (void)viewDidLoad { [super viewDidLoad]; // 设置控制器 self.rootView.controller = self;}
2 0
- UI_Target/action 设计模式
- UI_Target-Action
- UI_Target-Action
- Target-Action 设计模式
- target/action设计模式
- Target-Action 设计模式
- target/action设计模式
- target/action 设计模式
- target - action 设计模式
- Target/Action 设计模式
- UI target/action设计模式
- UI - Target-Action设计模式
- UIday05_zy01:target/action 设计模式
- 13.target/action设计模式
- target --action设计模式,以及delegate设计模式
- target --action设计模式,以及delegate设计模式
- iOS编程-------target/action设计模式 / 代理设计模式
- UI笔记_target...action设计模式
- android编辑实现背景音乐
- 大话设计模式C++版——装饰模式
- [华为机试练习题]48.阿姆斯特朗数
- 通知中心的使用
- 基于Mybatis的通用Service层实现【未验证】
- UI_Target/action 设计模式
- 即时通信客户端好友推荐方法和系统
- leetCode 6:ZigZag Conversion
- 适配器模式
- Java单例模式复习(二)
- qt creator创建cmake构建的程序,无法启动调试
- 从右到左布局(RTL Layout)
- 如何迅速秒杀掉:99%的海量数据处理面试题
- Bonjour写的聊天室的思路(二)——UI和logic