@@ -59,6 +59,9 @@ + (UIImage *)m2d_arrowIconWithDirection:(M2DArrowIconDirection)direction size:(C
5959
6060@interface M2DWebViewController ()
6161
62+ @property (nonatomic , copy ) UIImage *backArrowImage;
63+ @property (nonatomic , copy ) UIImage *forwardArrowImage;
64+
6265@end
6366
6467@implementation M2DWebViewController
@@ -78,6 +81,17 @@ - (id)initWithURL:(NSURL *)url type:(M2DWebViewType)type
7881 return self;
7982}
8083
84+ - (instancetype )initWithURL : (NSURL *)url type : (M2DWebViewType)type backArrowImage : (UIImage *)backArrowImage forwardArrowImage : (UIImage *)forwardArrowImage
85+ {
86+ self = [self initWithURL: url type: type];
87+ if (self) {
88+ self.backArrowImage = backArrowImage;
89+ self.forwardArrowImage = forwardArrowImage;
90+ }
91+
92+ return self;
93+ }
94+
8195- (void )dealloc
8296{
8397 [UIApplication sharedApplication ].networkActivityIndicatorVisible = NO ;
@@ -117,8 +131,8 @@ - (void)viewWillAppear:(BOOL)animated
117131 [self .navigationController setToolbarHidden: NO animated: YES ];
118132 if (goBackButton_ == nil ) {
119133 NSArray *toolbarItems = nil ;
120- goBackButton_ = [[UIBarButtonItem alloc ] initWithImage: [UIImage m2d_arrowIconWithDirection: M2DArrowIconDirectionLeft size: M2DArrowIconSize] style: UIBarButtonItemStylePlain target: self action: @selector (goBack: )];
121- goForwardButton_ = [[UIBarButtonItem alloc ] initWithImage: [UIImage m2d_arrowIconWithDirection: M2DArrowIconDirectionRight size: M2DArrowIconSize] style: UIBarButtonItemStylePlain target: self action: @selector (goForward: )];
134+ goBackButton_ = [[UIBarButtonItem alloc ] initWithImage: self .backArrowImage ?: [UIImage m2d_arrowIconWithDirection: M2DArrowIconDirectionLeft size: M2DArrowIconSize] style: UIBarButtonItemStylePlain target: self action: @selector (goBack: )];
135+ goForwardButton_ = [[UIBarButtonItem alloc ] initWithImage: self .forwardArrowImage ?: [UIImage m2d_arrowIconWithDirection: M2DArrowIconDirectionRight size: M2DArrowIconSize] style: UIBarButtonItemStylePlain target: self action: @selector (goForward: )];
122136 UIBarButtonItem *space = [[UIBarButtonItem alloc ] initWithBarButtonSystemItem: UIBarButtonSystemItemFlexibleSpace target: nil action: nil ];
123137 UIBarButtonItem *fixedSpace19 = [[UIBarButtonItem alloc ] initWithBarButtonSystemItem: UIBarButtonSystemItemFixedSpace target: nil action: nil ];
124138 fixedSpace19.width = 19 ;
0 commit comments