callPhoneProtocol.h文件
#import "EXTConcreteProtocol.h"
@protocol callPhoneProtocol <NSObject>
@concrete
- (void)callPhone;
@end
callPhoneProtocol.m文件
#import "TestDelegate.h"
#import "CKKTelView.h"
@concreteprotocol(callPhoneProtocol)
- (void)callPhone {
// 拨打电话
CKKTelView *view = [CKKTelView viewFromXib];
view.phone = @"400-100-8899";
[view show];
}
@end
在一个控制器中使用
一、遵守
@interface CKKHomeVC ()<callPhoneProtocol>
二、不实现,直接调用协议内的方法
- (IBAction)onClickMsgBarItem:(UIBarButtonItem *)item {
[self callPhone];
}
抽取框架libextobjc中的几个文件即可
参考:
https://blog.yeatse.com/2016/06/20/default-implementation-for-oc-protocol/