设为首页 加入收藏

TOP

Swift 05.Block(二)
2017-10-10 12:17:16 】 浏览:2122
Tags:Swift 05.Block
idLoad]; self.view.backgroundColor
= [UIColor grayColor]; UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake(150, 150, 20,30)]; btn.backgroundColor = [UIColor whiteColor]; [self.view addSubview:btn]; self.btn = btn;

      [btn setTitle:@"one" forState:UIControlStateNormal];

    [btn addTarget:self action:@selector(jump:) forControlEvents:UIControlEventTouchUpInside];
    
    self.textfield = [[UITextField alloc]initWithFrame:CGRectMake(50, 50, 200, 30)];
    self.textfield.borderStyle = UITextBorderStyleRoundedRect;

    [self.view addSubview:self.textfield];
}
//对应上面的第二步 ->调用
-(void)jump:(UIButton *)btn {

    if (self.myBlock) {
        self.myBlock(self.textfield.text);
    }

    [self.navigationController popToRootViewControllerAnimated:YES];
}

@end

 

首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇窥探Swift之使用Web浏览器编译Swi.. 下一篇窥探Swift系列博客说明及其Swift..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目