我想在应用代表上显示一些提醒。当我点击按钮时,警报应该保持在那里。如果在5分钟内没有采取任何行动,则警报要解雇。有人请帮我创建一个自定义警报。 const CGFloat fontSize = 24; //无论如何。
UILabel* label = [[UILabel alloc] initWithFrame:CGRectZero];
label.backgroundColor = [UIColor clearColor];
label.font = [UIFont fontWithName:@"Helvetica-Bold" size:fontSize]; // Or whatever.
label.text = message;
label.textColor = [UIColor blueColor]; // Or whatever.
[label sizeToFit];
label.center = point;
[self.view addSubview:label];
[UIView animateWithDuration:0.3 delay:1 options:0 animations:^{
label.alpha = 0;
} completion:^(BOOL finished) {
label.hidden = YES;
[label removeFromSuperview];
}];
答案 0 :(得分:0)
使用https://github.com/shantaramk/Custom-Alert-View
轻松实现此目标。只需执行以下步骤:
1。向下拖动项目目录中的AlertView文件夹
2。显示AlertView弹出窗口
func showUpdateProfilePopup(_ message: String) {
let alertView = AlertView(title: AlertMessage.success, message: message, okButtonText: LocalizedStrings.okay, cancelButtonText: "") { (_, button) in
if button == .other {
self.navigationController?.popViewController(animated: true)
}
}
alertView.show(animated: true)
}