Skip to content

Commit 8649da7

Browse files
author
Mike
committed
Fixed demo code
1 parent c0d00cc commit 8649da7

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

Demo/TestBadge/TestBadge/MasterViewController.m

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,28 @@ - (void)viewDidLoad
3232
UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(insertNewObject:)];
3333
self.navigationItem.rightBarButtonItem = addButton;
3434

35-
// Build your regular UIBarButtonItem with Custom View
36-
UIImage *image = [UIImage imageNamed:@"someImage"];
37-
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
38-
button.frame = CGRectMake(0,0,image.size.width, image.size.height);
39-
[button addTarget:self action:@selector(buttonPress:) forControlEvents:UIControlEventTouchDown];
40-
[button setBackgroundImage:image forState:UIControlStateNormal];
41-
42-
// Make BarButton Item
43-
UIBarButtonItem *navLeftButton = [[UIBarButtonItem alloc] initWithCustomView:button];
44-
self.navigationItem.leftBarButtonItem = navLeftButton;
45-
self.navigationItem.leftBarButtonItem.badgeValue = @"1";
46-
self.navigationItem.leftBarButtonItem.badgeBGColor = self.navigationController.navigationBar.tintColor;
35+
// // Build your regular UIBarButtonItem with Custom View
36+
// UIImage *image = [UIImage imageNamed:@"someImage"];
37+
// UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
38+
// button.frame = CGRectMake(0,0,image.size.width, image.size.height);
39+
// [button addTarget:self action:@selector(buttonPress:) forControlEvents:UIControlEventTouchDown];
40+
// [button setBackgroundImage:image forState:UIControlStateNormal];
41+
//
42+
// // Make BarButton Item
43+
// UIBarButtonItem *navLeftButton = [[UIBarButtonItem alloc] initWithCustomView:button];
44+
// self.navigationItem.leftBarButtonItem = navLeftButton;
45+
// self.navigationItem.leftBarButtonItem.badgeValue = @"1";
46+
// self.navigationItem.leftBarButtonItem.badgeBGColor = self.navigationController.navigationBar.tintColor;
4747

4848
// new method of adding badges
4949
UIImage *image2 = [UIImage imageNamed:@"someImage"];
5050
UIBarButtonItem *navRightButton = [[UIBarButtonItem alloc] initWithImage:image2
5151
style:UIBarButtonItemStylePlain
5252
target:self
5353
action:@selector(buttonPress:)];
54-
self.navigationItem.rightBarButtonItem = navRightButton;
55-
self.navigationItem.rightBarButtonItem.badgeValue = @"2";
56-
self.navigationItem.rightBarButtonItem.badgeBGColor = [UIColor orangeColor];
54+
self.navigationItem.leftBarButtonItem = navRightButton;
55+
self.navigationItem.leftBarButtonItem.badgeValue = @"2";
56+
self.navigationItem.leftBarButtonItem.badgeBGColor = [UIColor orangeColor];
5757

5858
}
5959

0 commit comments

Comments
 (0)