方向传值,用block传值要比用代理传值简单多,并且代码简单。
有一个A页面和B页面,B页面的值传给A页面,这就是用Block方向传值。
下面直接上代码
A页面代码
UIButton * playButton = [UIButton buttonWithType:UIButtonTypeCustom]; playButton.frame = CGRectMake(100, 220, 100, 80); [playButton setTitle:@"选择播放视频" forState:UIControlStateNormal]; [playButton setBackgroundColor:[UIColor grayColor]]; [playButton addTarget:self action:@selector(playVideoGo) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:playButton]; self.textLabel = [[UILabel alloc] initWithFrame:CGRectMake(100, 320, 100, 30)]; self.textLabel.backgroundCol
iOS中使用Block反响传值的用法
于 2015-11-14 10:51:19 首次发布