TFAlerView
一个非常强大的iOS消息通知和AlertView扩展。它可以轻松地从屏幕顶部、底部和中间弹出通知。您可以轻松自定义弹出视图。
英文说明
需求
- 需要iOS 9或更高版本
- 需要自动引用计数(ARC)
功能
- 易于使用
- 可以轻松定制
安装
CocoaPods
要使用 CocoaPods 安装 FFToast,请在现有的 Podfile 中集成它,或者创建一个新的 Podfile
target 'MyApp' do
pod 'TFAlerView'
end
#import "ViewController.h" #import <TFAlerView/TFAlerView.h> //#import "TFAlerView_AlertView.h" //#import "TFAlerView_CAlertView.h" //#import "TFAlerView_AlerView.h" @interface ViewController ()
@property (nonatomic, strong) TFAlerView_AlertView *tipV; @end // NSString *kSuccessTitle = @"Congratulations"; NSString *kErrorTitle = @"连接错误"; NSString *kNoticeTitle = @"通知"; NSString *kWarningTitle = @"警告"; NSString *kInfoTitle = @"信息"; NSString *kSubtitle = @"您已成功显示这个出色的弹出视图"; NSString *kButtonTitle = @"完成"; NSString *kAttributeTitle = @"成功完成富文本字符串操作。";
@implementation ViewController
- (void)viewDidLoad { [super viewDidLoad];
}
-(void)touchesMoved:(NSSet }TFAlerView_CAlertView *alert = [[TFAlerView_CAlertView alloc] initWithNewWindow];
TFAlerView_CButton *button = [alert addButton:@"First Button" target:self selector:@selector(firstButton)];
button.buttonFormatBlock = ^NSDictionary* (void)
{
NSMutableDictionary *buttonConfig = [[NSMutableDictionary alloc] init];
buttonConfig[@"backgroundColor"] = [UIColor whiteColor];
buttonConfig[@"textColor"] = [UIColor blackColor];
buttonConfig[@"borderWidth"] = @2.0f;
buttonConfig[@"borderColor"] = [UIColor greenColor];
return buttonConfig;
};
[alert addButton:@"Second Button" actionBlock:^(void) {
NSLog(@"Second button tapped");
}];
alert.soundURL = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/right_answer.mp3", [NSBundle mainBundle].resourcePath]];
[alert showSuccess:kSuccessTitle subTitle:kSubtitle closeButtonTitle:kButtonTitle duration:0.0f];