-
Notifications
You must be signed in to change notification settings - Fork 1
/
UIBarButtonItem_TLCommon.m
37 lines (27 loc) · 1.21 KB
/
UIBarButtonItem_TLCommon.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
//
// UIBarButtonItem_TLCommon.m
// TLCommon
//
// Created by Joshua Bleecher Snyder on 9/10/09.
//
#import "UIBarButtonItem_TLCommon.h"
#import "UIActivityIndicatorView_TLCommon.h"
@implementation UIBarButtonItem (TLCommon)
+ (UIBarButtonItem *)spinnerBarButtonItem {
UIActivityIndicatorView *spinner = [UIActivityIndicatorView animatingActivityIndicatorViewWithStyle:UIActivityIndicatorViewStyleWhite];
UIBarButtonItem *spinnerBarButtonItem = [[[UIBarButtonItem alloc] initWithCustomView:spinner] autorelease];
spinnerBarButtonItem.enabled = NO;
return spinnerBarButtonItem;
}
+ (UIBarButtonItem *)flexibleSpaceBarButtonItem {
return [self barButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
}
+ (UIBarButtonItem *)fixedSpaceBarButtonItemWithWidth:(CGFloat)spaceWidth {
UIBarButtonItem *fixedSpace = [self barButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
fixedSpace.width = spaceWidth;
return fixedSpace;
}
+ (UIBarButtonItem *)barButtonSystemItem:(UIBarButtonSystemItem)systemItem target:(id)target action:(SEL)action {
return [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:systemItem target:target action:action] autorelease];
}
@end