0

i want to display some alerts on the app delegate. when i tap on the button the alert should stay there. if no action with in 5min that alert want to dismiss. somebody please help me to create a custom alert. const CGFloat fontSize = 24; // Or whatever.

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];
}];
Manju SSP
  • 63
  • 6

1 Answers1

0

Use https://github.com/shantaramk/Custom-Alert-View

It is effortless to implement this. just follow the below steps:

1. Drag down the AlertView folder in the project directory

2. Show AlertView Popup

    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)
   }