Permalink
Browse files

Adding possibility to show and hide the refresh button.

  • Loading branch information...
pk committed Feb 14, 2012
1 parent aca0d4f commit a1cc3868738b4fcc2181b5f6d190afe606a3f34f
@@ -31,6 +31,7 @@
@property (nonatomic, assign, readwrite, getter=isBackButtonHidden) BOOL backButtonHidden;
@property (nonatomic, assign, readwrite, getter=isForwardButtonHidden) BOOL forwardButtonHidden;
+@property (nonatomic, assign, readwrite, getter=isRefreshButtonHidden) BOOL refreshButtonHidden;
- (void)loadRequest:(NSURLRequest *)aRequest;
@@ -30,6 +30,7 @@ @implementation PKWebBrowserController
@synthesize backButtonHidden = backButtonHidden_;
@synthesize forwardButtonHidden = forwardButtonHidden_;
+@synthesize refreshButtonHidden = refreshButtonHidden_;
#pragma mark - Initialization/Memory management
@@ -134,13 +135,15 @@ - (void)viewDidLoad {
[forwardButton release];
}
- UIBarButtonItem *refreshButton =
- [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh
- target:self
- action:@selector(refresh)];
- refreshButton.tag = UIBarButtonSystemItemRefresh;
- [leftItems addObject:refreshButton];
- [refreshButton release];
+ if (!self.isRefreshButtonHidden) {
+ UIBarButtonItem *refreshButton =
+ [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh
+ target:self
+ action:@selector(refresh)];
+ refreshButton.tag = UIBarButtonSystemItemRefresh;
+ [leftItems addObject:refreshButton];
+ [refreshButton release];
+ }
PKNavigationItem *item = [[PKNavigationItem alloc] initWithTitle:self.title];
[item setLeftButtonsWithArray:leftItems];

0 comments on commit a1cc386

Please sign in to comment.