Просмотр исходного кода

Move "copy curl" button to the toolbar

Tanner Bennett лет назад: 6
Родитель
Сommit
1953089653
1 измененных файлов с 12 добавлено и 2 удалено
  1. 12 2
      Classes/Network/FLEXNetworkTransactionDetailTableViewController.m

+ 12 - 2
Classes/Network/FLEXNetworkTransactionDetailTableViewController.m

@@ -17,6 +17,7 @@
 #import "FLEXUtility.h"
 #import "FLEXManager+Private.h"
 #import "FLEXTableView.h"
+#import "UIBarButtonItem+FLEX.h"
 
 typedef UIViewController *(^FLEXNetworkDetailRowSelectionFuture)(void);
 
@@ -55,8 +56,17 @@ typedef UIViewController *(^FLEXNetworkDetailRowSelectionFuture)(void);
     // Force grouped style
     self = [super initWithStyle:UITableViewStyleGrouped];
     if (self) {
-        [NSNotificationCenter.defaultCenter addObserver:self selector:@selector(handleTransactionUpdatedNotification:) name:kFLEXNetworkRecorderTransactionUpdatedNotification object:nil];
-        self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Copy curl" style:UIBarButtonItemStylePlain target:self action:@selector(copyButtonPressed:)];
+        [NSNotificationCenter.defaultCenter addObserver:self
+            selector:@selector(handleTransactionUpdatedNotification:)
+            name:kFLEXNetworkRecorderTransactionUpdatedNotification
+            object:nil
+        ];
+        self.toolbarItems = @[
+            UIBarButtonItem.flex_flexibleSpace,
+            [UIBarButtonItem
+                itemWithTitle:@"Copy curl" target:self action:@selector(copyButtonPressed:)
+            ]
+        ];
     }
     return self;
 }