pod导入相对很简单,主要讲怎么手动导入这个库
[TSMessage showNotificationWithTitle:@"标题"
subtitle:@"详细信息"
type:TSMessageNotificationTypeError];
[TSMessage showNotificationInViewController:self
title:@"标题"
subtitle:@"详细信息"
image:nil
type:TSMessageNotificationTypeMessage
duration:TSMessageNotificationDurationAutomatic
callback:nil
buttonTitle:@"按钮标题"
buttonCallback:^{
NSLog(@"按钮事件");
}
atPosition:TSMessageNotificationPositionTop
canBeDismissedByUser:YES];
[[TSMessageView appearance] setTitleFont:[UIFont boldSystemFontOfSize:6]];//标题字体大小
[[TSMessageView appearance] setTitleTextColor:[UIColor redColor]];//标题字体颜色
[[TSMessageView appearance] setContentFont:[UIFont boldSystemFontOfSize:10]];//内容字体大小
[[TSMessageView appearance]setContentTextColor:[UIColor greenColor]];//内容字体颜色
[[TSMessageView appearance]setErrorIcon:[UIImage imageNamed:@"NotificationButtonBackground"]];//自定义失败图片
[[TSMessageView appearance]setSuccessIcon:[UIImage imageNamed:@"NotificationButtonBackground"]];//自定义成功图片
[[TSMessageView appearance]setMessageIcon:[UIImage imageNamed:@"NotificationButtonBackground"]];//自定义信息展示图片
[[TSMessageView appearance]setWarningIcon:[UIImage imageNamed:@"NotificationButtonBackground"]];//自定义警告图片
首先你的样式应该是 TSMessageNotificationPositionNavBarOverlay,如:
if (self.navigationController.navigationBarHidden == NO) {
self.navigationController.navigationBarHidden = YES;
}//必须要加
[TSMessage showNotificationInViewController:self
title:@"标题"
subtitle:@"详细信息"
image:nil
type:TSMessageNotificationTypeMessage
duration:TSMessageNotificationDurationAutomatic
callback:nil
buttonTitle:@"按钮标题"
buttonCallback:^{
NSLog(@"按钮事件");
}
atPosition:TSMessageNotificationPositionNavBarOverlay
canBeDismissedByUser:YES];
然后在
- (void)fadeOutNotification:(TSMessageView *)currentView animationFinishedBlock:(void (^)())animationFinished
方法下加入
if (currentView.messagePosition == TSMessageNotificationPositionNavBarOverlay) {
UIViewController *vc = currentView.viewController;
vc.navigationController.navigationBarHidden = NO;
}