mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-20 12:38:09 +00:00
47 lines
1.3 KiB
Objective-C
47 lines
1.3 KiB
Objective-C
//
|
|
// UIConfirmationDialog.m
|
|
// linphone
|
|
//
|
|
// Created by Gautier Pelloux-Prayer on 11/09/15.
|
|
//
|
|
//
|
|
|
|
#import "UIConfirmationDialog.h"
|
|
#import "PhoneMainView.h"
|
|
|
|
@implementation UIConfirmationDialog
|
|
|
|
+ (void)ShowWithMessage:(NSString *)message
|
|
onCancelClick:(UIConfirmationBlock)onCancel
|
|
onConfirmationClick:(UIConfirmationBlock)onConfirm {
|
|
UIConfirmationDialog *dialog =
|
|
[[UIConfirmationDialog alloc] initWithNibName:NSStringFromClass(self.class) bundle:NSBundle.mainBundle];
|
|
|
|
[PhoneMainView.instance.mainViewController.view addSubview:dialog.view];
|
|
[PhoneMainView.instance.mainViewController addChildViewController:dialog];
|
|
|
|
dialog->onCancelCb = onCancel;
|
|
dialog->onConfirmCb = onConfirm;
|
|
|
|
[dialog.titleLabel setText:message];
|
|
dialog.confirmationButton.layer.borderColor =
|
|
[[UIColor colorWithPatternImage:[UIImage imageNamed:@"color_A"]] CGColor];
|
|
dialog.cancelButton.layer.borderColor = [[UIColor colorWithPatternImage:[UIImage imageNamed:@"color_F"]] CGColor];
|
|
}
|
|
|
|
- (IBAction)onCancelClick:(id)sender {
|
|
[self.view removeFromSuperview];
|
|
[self removeFromParentViewController];
|
|
if (onCancelCb) {
|
|
onCancelCb();
|
|
}
|
|
}
|
|
|
|
- (IBAction)onConfirmationClick:(id)sender {
|
|
[self.view removeFromSuperview];
|
|
[self removeFromParentViewController];
|
|
if (onConfirmCb) {
|
|
onConfirmCb();
|
|
}
|
|
}
|
|
@end
|