SkillAgentSearch skills...

MethodChaining

alertController 点语法链式添加action和textField,附上block实现点语法和链式编程的基本知识和技术分享

Install / Use

/learn @wode0weiyi/MethodChaining
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

MethodChaining

alertController通过点语法添加action和textField, 具体实现:

HGAlertViewController * alertVC = [HGAlertViewController alertControllerWithTitle:@"提示" message:@"选择" preferredStyle:(UIAlertControllerStyleAlert)];
    
    alertVC.addInput(@"输入账号",^(UITextField *textField){
        
        [[textField rac_textSignal] subscribeNext:^(id x) {
                NSLog(@"%@",textField.text);
        }];
    }).addAction(@"取消",^(UIAlertAction * action){
        NSLog(@"取消");
    }).addAction(@"确定",^(UIAlertAction *action){
        NSLog(@"确定");
    });
    [self presentViewController:alertVC animated:true completion:nil];

block链式编程基本语法和技术分享

有问题欢迎咨询

View on GitHub
GitHub Stars4
CategoryDevelopment
Updated10mo ago
Forks0

Languages

Objective-C

Security Score

67/100

Audited on May 25, 2025

No findings