Skip to content

Commit

Permalink
Made properties for background-image used in UIStatusBarStyleDefault …
Browse files Browse the repository at this point in the history
…public
  • Loading branch information
myell0w committed Jan 28, 2011
1 parent 4399fe4 commit 95d6c7b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
8 changes: 6 additions & 2 deletions MTStatusBarOverlay.h
Expand Up @@ -91,8 +91,8 @@ typedef enum MTMessageType {
BOOL hidesActivity_; BOOL hidesActivity_;


// Image of gray Status Bar // Image of gray Status Bar
UIImage *grayStatusBarImage_; UIImage *defaultStatusBarImage_;
UIImage *grayStatusBarImageSmall_; UIImage *defaultStatusBarImageShrinked_;


// Animation-Type // Animation-Type
MTStatusBarOverlayAnimation animation_; MTStatusBarOverlayAnimation animation_;
Expand Down Expand Up @@ -140,6 +140,10 @@ typedef enum MTMessageType {
@property (nonatomic, retain) UILabel *finishedLabel; @property (nonatomic, retain) UILabel *finishedLabel;
// if this flag is set to YES, neither activityIndicator nor finishedLabel are shown // if this flag is set to YES, neither activityIndicator nor finishedLabel are shown
@property (nonatomic, assign) BOOL hidesActivity; @property (nonatomic, assign) BOOL hidesActivity;
// the image used when the Status Bar Style is Default
@property (nonatomic, retain) UIImage *defaultStatusBarImage;
// the image used when the Status Bar Style is Default and the Overlay is shrinked
@property (nonatomic, retain) UIImage *defaultStatusBarImageShrinked;
// detect if status bar is currently shrinked // detect if status bar is currently shrinked
@property (nonatomic, readonly, getter=isShrinked) BOOL shrinked; @property (nonatomic, readonly, getter=isShrinked) BOOL shrinked;
// detect if detailView is currently hidden // detect if detailView is currently hidden
Expand Down
14 changes: 6 additions & 8 deletions MTStatusBarOverlay.m
Expand Up @@ -262,8 +262,6 @@ @interface MTStatusBarOverlay ()


@property (nonatomic, retain) UIActivityIndicatorView *activityIndicator; @property (nonatomic, retain) UIActivityIndicatorView *activityIndicator;
@property (nonatomic, retain) UIImageView *statusBarBackgroundImageView; @property (nonatomic, retain) UIImageView *statusBarBackgroundImageView;
@property (nonatomic, retain) UIImage *grayStatusBarImage;
@property (nonatomic, retain) UIImage *grayStatusBarImageSmall;
@property (nonatomic, retain) UILabel *statusLabel1; @property (nonatomic, retain) UILabel *statusLabel1;
@property (nonatomic, retain) UILabel *statusLabel2; @property (nonatomic, retain) UILabel *statusLabel2;
@property (nonatomic, assign) UILabel *hiddenStatusLabel; @property (nonatomic, assign) UILabel *hiddenStatusLabel;
Expand Down Expand Up @@ -336,8 +334,8 @@ @implementation MTStatusBarOverlay
@synthesize activityIndicator = activityIndicator_; @synthesize activityIndicator = activityIndicator_;
@synthesize finishedLabel = finishedLabel_; @synthesize finishedLabel = finishedLabel_;
@synthesize hidesActivity = hidesActivity_; @synthesize hidesActivity = hidesActivity_;
@synthesize grayStatusBarImage = grayStatusBarImage_; @synthesize defaultStatusBarImage = defaultStatusBarImage_;
@synthesize grayStatusBarImageSmall = grayStatusBarImageSmall_; @synthesize defaultStatusBarImageShrinked = grayStatusBarImageSmall_;
@synthesize smallFrame = smallFrame_; @synthesize smallFrame = smallFrame_;
@synthesize oldBackgroundViewFrame = oldBackgroundViewFrame_; @synthesize oldBackgroundViewFrame = oldBackgroundViewFrame_;
@synthesize animation = animation_; @synthesize animation = animation_;
Expand Down Expand Up @@ -436,7 +434,7 @@ - (id)initWithFrame:(CGRect)frame {


// Image of gray status bar // Image of gray status bar
NSData *pngData = [NSData dataWithBytesNoCopy:statusBarBackgroundGrey_png length:statusBarBackgroundGrey_png_len freeWhenDone:NO]; NSData *pngData = [NSData dataWithBytesNoCopy:statusBarBackgroundGrey_png length:statusBarBackgroundGrey_png_len freeWhenDone:NO];
grayStatusBarImage_ = [[UIImage imageWithData:pngData] retain]; defaultStatusBarImage_ = [[UIImage imageWithData:pngData] retain];


NSData *pngDataSmall = [NSData dataWithBytesNoCopy:statusBarBackgroundGreySmall_png length:statusBarBackgroundGreySmall_png_len freeWhenDone:NO]; NSData *pngDataSmall = [NSData dataWithBytesNoCopy:statusBarBackgroundGreySmall_png length:statusBarBackgroundGreySmall_png_len freeWhenDone:NO];
grayStatusBarImageSmall_ = [[UIImage imageWithData:pngDataSmall] retain]; grayStatusBarImageSmall_ = [[UIImage imageWithData:pngDataSmall] retain];
Expand Down Expand Up @@ -510,7 +508,7 @@ - (void)dealloc {
[statusLabel2_ release], statusLabel2_ = nil; [statusLabel2_ release], statusLabel2_ = nil;
[activityIndicator_ release], activityIndicator_ = nil; [activityIndicator_ release], activityIndicator_ = nil;
[finishedLabel_ release], finishedLabel_ = nil; [finishedLabel_ release], finishedLabel_ = nil;
[grayStatusBarImage_ release], grayStatusBarImage_ = nil; [defaultStatusBarImage_ release], defaultStatusBarImage_ = nil;
[grayStatusBarImageSmall_ release], grayStatusBarImageSmall_ = nil; [grayStatusBarImageSmall_ release], grayStatusBarImageSmall_ = nil;
[detailText_ release], detailText_ = nil; [detailText_ release], detailText_ = nil;
[detailTextView_ release], detailTextView_ = nil; [detailTextView_ release], detailTextView_ = nil;
Expand Down Expand Up @@ -1074,9 +1072,9 @@ - (void)setStatusBarBackgroundForStyle:(UIStatusBarStyle)style {
if (style == UIStatusBarStyleDefault && !IsIPad && !IsIPhoneEmulationMode) { if (style == UIStatusBarStyleDefault && !IsIPad && !IsIPhoneEmulationMode) {
// choose image depending on size // choose image depending on size
if (self.shrinked) { if (self.shrinked) {
self.statusBarBackgroundImageView.image = [self.grayStatusBarImageSmall stretchableImageWithLeftCapWidth:2.0f topCapHeight:0.0f]; self.statusBarBackgroundImageView.image = [self.defaultStatusBarImageShrinked stretchableImageWithLeftCapWidth:2.0f topCapHeight:0.0f];
} else { } else {
self.statusBarBackgroundImageView.image = [self.grayStatusBarImage stretchableImageWithLeftCapWidth:2.0f topCapHeight:0.0f]; self.statusBarBackgroundImageView.image = [self.defaultStatusBarImage stretchableImageWithLeftCapWidth:2.0f topCapHeight:0.0f];
} }
} }


Expand Down

0 comments on commit 95d6c7b

Please sign in to comment.