forked from PSPDFKit/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RCTConvert+UIBarButtonItem.m
82 lines (77 loc) · 3.71 KB
/
RCTConvert+UIBarButtonItem.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//
// Copyright © 2019-2020 PSPDFKit GmbH. All rights reserved.
//
// THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
// AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT.
// UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
// This notice may not be removed from this file.
//
#import "RCTConvert+UIBarButtonItem.h"
@implementation RCTConvert (UIBarButtonItem)
+ (NSString *)stringBarButtonItemFrom:(UIBarButtonItem *)barButtonItem forViewController:(PSPDFViewController *)pdfController {
if (barButtonItem == pdfController.closeButtonItem) {
return @"closeButtonItem";
} else if (barButtonItem == pdfController.outlineButtonItem) {
return @"outlineButtonItem";
} else if (barButtonItem == pdfController.searchButtonItem) {
return @"searchButtonItem";
} else if (barButtonItem == pdfController.thumbnailsButtonItem) {
return @"thumbnailsButtonItem";
} else if (barButtonItem == pdfController.documentEditorButtonItem) {
return @"documentEditorButtonItem";
} else if (barButtonItem == pdfController.printButtonItem) {
return @"printButtonItem";
} else if (barButtonItem == pdfController.openInButtonItem) {
return @"openInButtonItem";
} else if (barButtonItem == pdfController.emailButtonItem) {
return @"emailButtonItem";
} else if (barButtonItem == pdfController.messageButtonItem) {
return @"messageButtonItem";
} else if (barButtonItem == pdfController.annotationButtonItem) {
return @"annotationButtonItem";
} else if (barButtonItem == pdfController.bookmarkButtonItem) {
return @"bookmarkButtonItem";
} else if (barButtonItem == pdfController.brightnessButtonItem) {
return @"brightnessButtonItem";
} else if (barButtonItem == pdfController.activityButtonItem) {
return @"activityButtonItem";
} else if (barButtonItem == pdfController.settingsButtonItem) {
return @"settingsButtonItem";
} else {
return nil;
}
}
+ (UIBarButtonItem *)uiBarButtonItemFrom:(NSString *)barButtonItem forViewController:(PSPDFViewController *)pdfController {
if ([barButtonItem isEqualToString:@"closeButtonItem"]) {
return pdfController.closeButtonItem;
} else if ([barButtonItem isEqualToString:@"outlineButtonItem"]) {
return pdfController.outlineButtonItem;
} else if ([barButtonItem isEqualToString:@"searchButtonItem"]) {
return pdfController.searchButtonItem;
} else if ([barButtonItem isEqualToString:@"thumbnailsButtonItem"]) {
return pdfController.thumbnailsButtonItem;
} else if ([barButtonItem isEqualToString:@"documentEditorButtonItem"]) {
return pdfController.documentEditorButtonItem;
} else if ([barButtonItem isEqualToString:@"printButtonItem"]) {
return pdfController.printButtonItem;
} else if ([barButtonItem isEqualToString:@"openInButtonItem"]) {
return pdfController.openInButtonItem;
} else if ([barButtonItem isEqualToString:@"emailButtonItem"]) {
return pdfController.emailButtonItem;
} else if ([barButtonItem isEqualToString:@"messageButtonItem"]) {
return pdfController.messageButtonItem;
} else if ([barButtonItem isEqualToString:@"annotationButtonItem"]) {
return pdfController.annotationButtonItem;
} else if ([barButtonItem isEqualToString:@"bookmarkButtonItem"]) {
return pdfController.bookmarkButtonItem;
} else if ([barButtonItem isEqualToString:@"brightnessButtonItem"]) {
return pdfController.brightnessButtonItem;
} else if ([barButtonItem isEqualToString:@"activityButtonItem"]) {
return pdfController.activityButtonItem;
} else if ([barButtonItem isEqualToString:@"settingsButtonItem"]) {
return pdfController.settingsButtonItem;
} else {
return nil;
}
}
@end