新人求助,ios开发中 俩个ViewController之间如何传值
1个回答
展开全部
/第二个界面制定协议
@protocol ChuanZhiDelegate
- (void)chuanzhid;
@end
@interface ViewController2 : UIViewController
@property(nonatomic,assign)idchuanzhidelegate;
@end
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor=[UIColor cyanColor];
self.btn=[[UIButton alloc]initWithFrame:CGRectMake(70, 100, 100, 30)];
self.btn.backgroundColor=[UIColor redColor];
[self.view addSubview:self.btn];
@protocol ChuanZhiDelegate
- (void)chuanzhid;
@end
@interface ViewController2 : UIViewController
@property(nonatomic,assign)idchuanzhidelegate;
@end
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor=[UIColor cyanColor];
self.btn=[[UIButton alloc]initWithFrame:CGRectMake(70, 100, 100, 30)];
self.btn.backgroundColor=[UIColor redColor];
[self.view addSubview:self.btn];
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询