├── README.markdown ├── Screenshots ├── Landscape.png └── Portrait.png ├── UIDickBar.h ├── UIDickBar.m ├── UIDickBar.xcodeproj └── project.pbxproj ├── UIDickBar ├── DemoAppDelegate.h ├── DemoAppDelegate.m ├── RootViewController.h ├── RootViewController.m ├── UIDickBar-Info.plist ├── UIDickBar-Prefix.pch ├── en.lproj │ ├── InfoPlist.strings │ ├── MainWindow.xib │ └── RootViewController.xib └── main.m ├── UIDickBarController.h ├── UIDickBarController.m ├── trends-icon.png └── trends-icon@2x.png /README.markdown: -------------------------------------------------------------------------------- 1 | # UIDickBar, An Awful Idea. # 2 | 3 | [#Dickbar][1], "[Twitter's mainstream consumer client experience][4]", now available for your iOS app too. 4 | 5 | ![](https://github.com/digdog/UIDickBar/raw/master/Screenshots/Landscape.png) 6 | 7 | ## Update ## 8 | 9 | On March 31, 2011, Twitter [removed][5] the UIDickBar from their iPhone client version 3.3.3. 10 | 11 | Problems underlying the UIDickBar are analyzed and concluded here: [**Problems and the Solution for UIDickBar**](http://digdog.tumblr.com/post/3729884380/problems-and-the-solution-for-uidickbar), read it if you're interested. 12 | 13 | ## Requirement ## 14 | 15 | 1. iOS 4.0 or later (Sample project was created from Xcode 4 GM 2) 16 | 2. Use LLVM Clang 2.0 compiler 17 | 18 | ## Usage ## 19 | 20 | You simply init UIDickBar with title, badge and an action block: 21 | 22 | UIDickBar *dickBar = [[UIDickBar alloc] initWithDickTitle:@"#DickBar" dickBadge:@"Stupid" actionBlock:^{ 23 | // Anything you want to do after UIDickBar tapped 24 | [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://digdog.tumblr.com"]]; 25 | }]; 26 | [dickBar showInView:self.view]; 27 | [dickBar release]; 28 | 29 | Then you call -showInView: to display UIDickBar that originates from the specified view. 30 | 31 | ## Features ## 32 | 33 | 1. Look like real [#dickbar][1]. 34 | 2. No fancy animations. 35 | 3. Support rotation. 36 | 4. Support Blocks. 37 | 5. Use UIDickBar to get tons of one star reviews, priceless. 38 | 39 | ## Screenshots ## 40 | 41 | ![](https://github.com/digdog/UIDickBar/raw/master/Screenshots/Landscape.png) 42 | 43 | ![](https://github.com/digdog/UIDickBar/raw/master/Screenshots/Portrait.png) 44 | 45 | ## Credit ## 46 | 47 | This project is created by [Ching-Lan 'digdog' Huang][2]. Alone with helps from following people: 48 | 49 | * [Daniel Tull][3] 50 | 51 | Thanks! 52 | 53 | ## License ## 54 | 55 | UIDickBar is released under MIT License. 56 | 57 | [1]: http://twitter.com/#search?q=%23dickbar 58 | [2]: http://digdog.tumblr.com 59 | [3]: http://danieltull.co.uk/ 60 | [4]: https://groups.google.com/forum/#!topic/twitter-api-announce/yCzVnHqHIWo/discussion 61 | [5]: http://blog.twitter.com/2011/03/so-bar-walks-into-app.html -------------------------------------------------------------------------------- /Screenshots/Landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digdog/UIDickBar/461f4c3b6f6f990f61bf2e9dc28020dc65c947d7/Screenshots/Landscape.png -------------------------------------------------------------------------------- /Screenshots/Portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digdog/UIDickBar/461f4c3b6f6f990f61bf2e9dc28020dc65c947d7/Screenshots/Portrait.png -------------------------------------------------------------------------------- /UIDickBar.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIDickBar.h 3 | // UIDickBar 4 | // 5 | // Created by digdog on 3/6/11. 6 | // Copyright 2011 Ching-Lan 'digdog' HUANG. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef void (^UIDickBarActionBlock)(); 12 | 13 | @interface UIDickBar : UIControl { 14 | } 15 | @property (nonatomic, copy, readonly) NSString *dickTitle; 16 | @property (nonatomic, copy, readonly) NSString *dickBadge; 17 | 18 | - (id)initWithDickTitle:(NSString *)title dickBadge:(NSString *)badge actionBlock:(UIDickBarActionBlock)action; 19 | - (void)updateDickTitle:(NSString *)title dickBadge:(NSString *)badge actionBlock:(UIDickBarActionBlock)action; 20 | - (void)showInView:(UIView *)view; 21 | @end 22 | -------------------------------------------------------------------------------- /UIDickBar.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIDickBar.m 3 | // UIDickBar 4 | // 5 | // Created by digdog on 3/6/11. 6 | // Copyright 2011 Ching-Lan 'digdog' HUANG. All rights reserved. 7 | // 8 | 9 | #import "UIDickBar.h" 10 | 11 | @interface UIDickBar () { 12 | UIDickBarActionBlock actionBlock_; 13 | } 14 | 15 | @property (nonatomic, copy) NSString *dickTitle; 16 | @property (nonatomic, copy) NSString *dickBadge; 17 | 18 | - (void)callActionBlock_:(id)sender; 19 | - (void)orientationChanged_:(NSNotification *)notification; 20 | @end 21 | 22 | 23 | @implementation UIDickBar 24 | 25 | @synthesize dickTitle = dickTitle_; 26 | @synthesize dickBadge = dickBadge_; 27 | 28 | - (id)initWithDickTitle:(NSString *)title dickBadge:(NSString *)badge actionBlock:(UIDickBarActionBlock)action 29 | { 30 | self = [super initWithFrame:CGRectZero]; 31 | if (self) { 32 | self.opaque = NO; 33 | self.backgroundColor = [UIColor clearColor]; 34 | self.autoresizingMask = UIViewAutoresizingFlexibleWidth; 35 | 36 | dickTitle_ = [title copy]; 37 | dickBadge_ = [badge copy]; 38 | actionBlock_ = Block_copy(action); 39 | 40 | [self addTarget:self action:@selector(callActionBlock_:) forControlEvents:UIControlEventTouchUpInside]; 41 | 42 | [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; 43 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged_:) 44 | name:UIDeviceOrientationDidChangeNotification object:nil]; 45 | } 46 | return self; 47 | } 48 | 49 | - (void)drawRect:(CGRect)rect 50 | { 51 | CGContextRef context = UIGraphicsGetCurrentContext(); 52 | 53 | CGContextSaveGState(context); 54 | CGFloat colors[] = { 55 | 0.0f, 0.0f, 0.0f, 0.8f, 56 | 0.1f, 0.1f, 0.1f, 0.8f 57 | }; 58 | 59 | CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB(); 60 | CGGradientRef gradient = CGGradientCreateWithColorComponents(rgb, colors, NULL, 2); 61 | CGColorSpaceRelease(rgb); 62 | 63 | CGPoint start = CGPointMake(rect.origin.x, rect.origin.y); 64 | CGPoint end = CGPointMake(rect.origin.x, rect.origin.y + 1); 65 | 66 | CGContextClipToRect(context, rect); 67 | CGContextDrawLinearGradient(context, gradient, start, end, kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation); 68 | 69 | CGGradientRelease(gradient); 70 | CGContextRestoreGState(context); 71 | 72 | UIImage *image = [UIImage imageNamed:@"trends-icon"]; 73 | [image drawAtPoint:CGPointMake(lround((rect.size.height - image.size.width) / 2), lround((rect.size.height - image.size.height) / 2)) blendMode:kCGBlendModeScreen alpha:0.8f]; 74 | 75 | if (self.dickTitle) { 76 | CGContextSaveGState(context); 77 | UIFont *dickTitleFont = [UIFont boldSystemFontOfSize:18.0f]; 78 | CGSize dickTitleSize = [self.dickTitle sizeWithFont:dickTitleFont]; 79 | CGFloat dickTitlePointY = lround((rect.size.height - dickTitleSize.height) / 2); 80 | CGFloat dickTitlePointX = rect.size.height + dickTitlePointY; 81 | 82 | [[UIColor colorWithWhite:0.0 alpha:0.8] set]; 83 | [self.dickTitle drawAtPoint:CGPointMake(dickTitlePointX, dickTitlePointY) withFont:dickTitleFont]; 84 | 85 | [[UIColor colorWithWhite:1.0 alpha:0.8] set]; 86 | [self.dickTitle drawAtPoint:CGPointMake(dickTitlePointX, dickTitlePointY + 1) withFont:dickTitleFont]; 87 | CGContextRestoreGState(context); 88 | } 89 | 90 | if (self.dickBadge) { 91 | CGContextSaveGState(context); 92 | UIFont *dickBadgeFont = [UIFont systemFontOfSize:11.0f]; 93 | CGSize dickBadgeSize = [self.dickBadge sizeWithFont:dickBadgeFont]; 94 | CGFloat dickBadgePointY = lround((rect.size.height - dickBadgeSize.height) / 2); 95 | CGFloat dickBadgePointX = lround(rect.origin.x + rect.size.width - dickBadgePointY * 1.5 - dickBadgeSize.width); 96 | 97 | CGMutablePathRef path = CGPathCreateMutable(); 98 | CGFloat minX = dickBadgePointX - 10.0f; 99 | CGFloat maxX = dickBadgePointX + dickBadgeSize.width + 10.0f; 100 | CGFloat minY = dickBadgePointY - 2.0f; 101 | CGFloat maxY = dickBadgePointY + dickBadgeSize.height + 2.0f; 102 | 103 | CGPathMoveToPoint(path, NULL, minX, minY + 4.0f); 104 | CGPathAddArcToPoint(path, NULL, minX, minY, minX + 4.0f, minY , 4.0f); 105 | CGPathAddLineToPoint(path, NULL, maxX - 4.0f, minY); 106 | CGPathAddArcToPoint(path, NULL, maxX, minY, maxX, minY + 4.0f, 4.0f); 107 | CGPathAddLineToPoint(path, NULL, maxX, maxY - 4.0f); 108 | CGPathAddArcToPoint(path, NULL, maxX, maxY, maxX - 4.0f, maxY, 4.0f); 109 | CGPathAddLineToPoint(path, NULL, minX + 4.0f, maxY); 110 | CGPathAddArcToPoint(path, NULL, minX, maxY, minX, maxY - 4.0f, 4.0f); 111 | CGPathAddLineToPoint(path, NULL, minX, minY + 4.0f); 112 | 113 | CGContextAddPath(context, path); 114 | CGContextClip(context); 115 | CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB(); 116 | CGFloat colors[] = 117 | { 118 | 1.0f, 0.957f, 0.573f, 1.0f, 119 | 0.996f, 0.843f, 0.506f, 1.0f, 120 | }; 121 | CGGradientRef gradient = CGGradientCreateWithColorComponents(rgb, colors, NULL, sizeof(colors)/(sizeof(colors[0])*4)); 122 | CGColorSpaceRelease(rgb); 123 | CGContextDrawLinearGradient(context, gradient, CGPointMake(0., minY), CGPointMake(0., maxY), 0.); 124 | CGGradientRelease(gradient); 125 | 126 | CFRelease(path); 127 | 128 | [[UIColor colorWithRed:0.522f green:0.249f blue:0.208f alpha:1.0f] set]; 129 | [self.dickBadge drawAtPoint:CGPointMake(dickBadgePointX, dickBadgePointY) withFont:dickBadgeFont]; 130 | CGContextRestoreGState(context); 131 | } 132 | 133 | CGContextSaveGState(context); 134 | CGContextSetLineWidth(context, 1.0f); 135 | 136 | CGContextSetRGBStrokeColor(context, 0.1, 0.1, 0.1, 0.2); 137 | CGContextMoveToPoint(context, rect.origin.x, lround(rect.size.height / 2)); 138 | CGContextAddLineToPoint(context, rect.origin.x + rect.size.width, lround(rect.size.height / 2)); 139 | CGContextStrokePath(context); 140 | 141 | CGContextMoveToPoint(context, rect.origin.x + rect.size.height, rect.origin.y); 142 | CGContextAddLineToPoint(context, rect.origin.x + rect.size.height, rect.origin.y + rect.size.height); 143 | CGContextStrokePath(context); 144 | 145 | CGContextSetRGBStrokeColor(context, 0.8, 0.8, 0.8, 0.2); 146 | CGContextMoveToPoint(context, rect.origin.x, lround(rect.size.height / 2) + 0.5); 147 | CGContextAddLineToPoint(context, rect.origin.x + rect.size.width, lround(rect.size.height / 2) + 0.5); 148 | CGContextStrokePath(context); 149 | 150 | CGContextMoveToPoint(context, rect.origin.x + rect.size.height + 0.5, rect.origin.y); 151 | CGContextAddLineToPoint(context, rect.origin.x + rect.size.height + 0.5, rect.origin.y + rect.size.height); 152 | CGContextStrokePath(context); 153 | CGContextRestoreGState(context); 154 | } 155 | 156 | - (void)updateDickTitle:(NSString *)title dickBadge:(NSString *)badge actionBlock:(UIDickBarActionBlock)action 157 | { 158 | self.dickTitle = title; 159 | self.dickBadge = badge; 160 | 161 | [self removeTarget:self action:@selector(callActionBlock_:) forControlEvents:UIControlEventTouchUpInside]; 162 | Block_release(actionBlock_); 163 | actionBlock_ = Block_copy(action); 164 | [self addTarget:self action:@selector(callActionBlock_:) forControlEvents:UIControlEventTouchUpInside]; 165 | 166 | [self setNeedsDisplay]; 167 | } 168 | 169 | - (void)showInView:(UIView *)view 170 | { 171 | if (view) { 172 | self.frame = CGRectMake(0.0f, -44.0f, view.frame.size.width, 44.0f); 173 | 174 | if (self.superview) { 175 | [self removeFromSuperview]; 176 | } 177 | [view addSubview:self]; 178 | 179 | [UIView beginAnimations:nil context:NULL]; 180 | self.frame = CGRectMake(0.0f, 0.0f, view.frame.size.width, 44.0f); 181 | [UIView commitAnimations]; 182 | } 183 | } 184 | 185 | - (void)callActionBlock_:(id)sender { 186 | actionBlock_(); 187 | } 188 | 189 | - (void)orientationChanged_:(NSNotification *)notification 190 | { 191 | [self setNeedsDisplay]; 192 | } 193 | 194 | - (void)dealloc 195 | { 196 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 197 | [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications]; 198 | 199 | [dickTitle_ release]; 200 | [dickBadge_ release]; 201 | 202 | Block_release(actionBlock_); 203 | 204 | [super dealloc]; 205 | } 206 | 207 | @end 208 | -------------------------------------------------------------------------------- /UIDickBar.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 241CD29213263BCA00FABBEC /* UIDickBarController.m in Sources */ = {isa = PBXBuildFile; fileRef = 241CD29113263BCA00FABBEC /* UIDickBarController.m */; }; 11 | 7709ADE713243258000FD1E4 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7709ADE613243258000FD1E4 /* UIKit.framework */; }; 12 | 7709ADE913243258000FD1E4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7709ADE813243258000FD1E4 /* Foundation.framework */; }; 13 | 7709ADEB13243258000FD1E4 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7709ADEA13243258000FD1E4 /* CoreGraphics.framework */; }; 14 | 7709ADF113243258000FD1E4 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 7709ADEF13243258000FD1E4 /* InfoPlist.strings */; }; 15 | 7709ADF413243258000FD1E4 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 7709ADF313243258000FD1E4 /* main.m */; }; 16 | 7709ADF713243258000FD1E4 /* DemoAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7709ADF613243258000FD1E4 /* DemoAppDelegate.m */; }; 17 | 7709ADFA13243258000FD1E4 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7709ADF813243258000FD1E4 /* MainWindow.xib */; }; 18 | 7709ADFD13243258000FD1E4 /* RootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7709ADFC13243258000FD1E4 /* RootViewController.m */; }; 19 | 7709AE0013243258000FD1E4 /* RootViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7709ADFE13243258000FD1E4 /* RootViewController.xib */; }; 20 | 7709AE081324331A000FD1E4 /* UIDickBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 7709AE071324331A000FD1E4 /* UIDickBar.m */; }; 21 | 7709AE8D132473A6000FD1E4 /* trends-icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 7709AE8B132473A5000FD1E4 /* trends-icon.png */; }; 22 | 7709AE8E132473A6000FD1E4 /* trends-icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7709AE8C132473A5000FD1E4 /* trends-icon@2x.png */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXFileReference section */ 26 | 241CD29013263BCA00FABBEC /* UIDickBarController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIDickBarController.h; sourceTree = ""; }; 27 | 241CD29113263BCA00FABBEC /* UIDickBarController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIDickBarController.m; sourceTree = ""; }; 28 | 7709ADE213243258000FD1E4 /* UIDickBar.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UIDickBar.app; sourceTree = BUILT_PRODUCTS_DIR; }; 29 | 7709ADE613243258000FD1E4 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 30 | 7709ADE813243258000FD1E4 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 31 | 7709ADEA13243258000FD1E4 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 32 | 7709ADEE13243258000FD1E4 /* UIDickBar-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "UIDickBar-Info.plist"; sourceTree = ""; }; 33 | 7709ADF013243258000FD1E4 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 34 | 7709ADF213243258000FD1E4 /* UIDickBar-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIDickBar-Prefix.pch"; sourceTree = ""; }; 35 | 7709ADF313243258000FD1E4 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 36 | 7709ADF513243258000FD1E4 /* DemoAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DemoAppDelegate.h; sourceTree = ""; }; 37 | 7709ADF613243258000FD1E4 /* DemoAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DemoAppDelegate.m; sourceTree = ""; }; 38 | 7709ADF913243258000FD1E4 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = ""; }; 39 | 7709ADFB13243258000FD1E4 /* RootViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = ""; }; 40 | 7709ADFC13243258000FD1E4 /* RootViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RootViewController.m; sourceTree = ""; }; 41 | 7709ADFF13243258000FD1E4 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/RootViewController.xib; sourceTree = ""; }; 42 | 7709AE061324331A000FD1E4 /* UIDickBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIDickBar.h; sourceTree = ""; }; 43 | 7709AE071324331A000FD1E4 /* UIDickBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIDickBar.m; sourceTree = ""; }; 44 | 7709AE8B132473A5000FD1E4 /* trends-icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "trends-icon.png"; sourceTree = ""; }; 45 | 7709AE8C132473A5000FD1E4 /* trends-icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "trends-icon@2x.png"; sourceTree = ""; }; 46 | /* End PBXFileReference section */ 47 | 48 | /* Begin PBXFrameworksBuildPhase section */ 49 | 7709ADDF13243258000FD1E4 /* Frameworks */ = { 50 | isa = PBXFrameworksBuildPhase; 51 | buildActionMask = 2147483647; 52 | files = ( 53 | 7709ADE713243258000FD1E4 /* UIKit.framework in Frameworks */, 54 | 7709ADE913243258000FD1E4 /* Foundation.framework in Frameworks */, 55 | 7709ADEB13243258000FD1E4 /* CoreGraphics.framework in Frameworks */, 56 | ); 57 | runOnlyForDeploymentPostprocessing = 0; 58 | }; 59 | /* End PBXFrameworksBuildPhase section */ 60 | 61 | /* Begin PBXGroup section */ 62 | 7709ADD713243258000FD1E4 = { 63 | isa = PBXGroup; 64 | children = ( 65 | 7709AE061324331A000FD1E4 /* UIDickBar.h */, 66 | 7709AE071324331A000FD1E4 /* UIDickBar.m */, 67 | 241CD29013263BCA00FABBEC /* UIDickBarController.h */, 68 | 241CD29113263BCA00FABBEC /* UIDickBarController.m */, 69 | 7709AE8B132473A5000FD1E4 /* trends-icon.png */, 70 | 7709AE8C132473A5000FD1E4 /* trends-icon@2x.png */, 71 | 7709ADEC13243258000FD1E4 /* Demo */, 72 | 7709ADE513243258000FD1E4 /* Frameworks */, 73 | 7709ADE313243258000FD1E4 /* Products */, 74 | ); 75 | sourceTree = ""; 76 | }; 77 | 7709ADE313243258000FD1E4 /* Products */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | 7709ADE213243258000FD1E4 /* UIDickBar.app */, 81 | ); 82 | name = Products; 83 | sourceTree = ""; 84 | }; 85 | 7709ADE513243258000FD1E4 /* Frameworks */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | 7709ADE613243258000FD1E4 /* UIKit.framework */, 89 | 7709ADE813243258000FD1E4 /* Foundation.framework */, 90 | 7709ADEA13243258000FD1E4 /* CoreGraphics.framework */, 91 | ); 92 | name = Frameworks; 93 | sourceTree = ""; 94 | }; 95 | 7709ADEC13243258000FD1E4 /* Demo */ = { 96 | isa = PBXGroup; 97 | children = ( 98 | 7709ADF513243258000FD1E4 /* DemoAppDelegate.h */, 99 | 7709ADF613243258000FD1E4 /* DemoAppDelegate.m */, 100 | 7709ADF813243258000FD1E4 /* MainWindow.xib */, 101 | 7709ADFB13243258000FD1E4 /* RootViewController.h */, 102 | 7709ADFC13243258000FD1E4 /* RootViewController.m */, 103 | 7709ADFE13243258000FD1E4 /* RootViewController.xib */, 104 | 7709ADED13243258000FD1E4 /* Supporting Files */, 105 | ); 106 | name = Demo; 107 | path = UIDickBar; 108 | sourceTree = ""; 109 | }; 110 | 7709ADED13243258000FD1E4 /* Supporting Files */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 7709ADEE13243258000FD1E4 /* UIDickBar-Info.plist */, 114 | 7709ADEF13243258000FD1E4 /* InfoPlist.strings */, 115 | 7709ADF213243258000FD1E4 /* UIDickBar-Prefix.pch */, 116 | 7709ADF313243258000FD1E4 /* main.m */, 117 | ); 118 | name = "Supporting Files"; 119 | sourceTree = ""; 120 | }; 121 | /* End PBXGroup section */ 122 | 123 | /* Begin PBXNativeTarget section */ 124 | 7709ADE113243258000FD1E4 /* UIDickBar */ = { 125 | isa = PBXNativeTarget; 126 | buildConfigurationList = 7709AE0313243258000FD1E4 /* Build configuration list for PBXNativeTarget "UIDickBar" */; 127 | buildPhases = ( 128 | 7709ADDE13243258000FD1E4 /* Sources */, 129 | 7709ADDF13243258000FD1E4 /* Frameworks */, 130 | 7709ADE013243258000FD1E4 /* Resources */, 131 | ); 132 | buildRules = ( 133 | ); 134 | dependencies = ( 135 | ); 136 | name = UIDickBar; 137 | productName = UIDickBar; 138 | productReference = 7709ADE213243258000FD1E4 /* UIDickBar.app */; 139 | productType = "com.apple.product-type.application"; 140 | }; 141 | /* End PBXNativeTarget section */ 142 | 143 | /* Begin PBXProject section */ 144 | 7709ADD913243258000FD1E4 /* Project object */ = { 145 | isa = PBXProject; 146 | buildConfigurationList = 7709ADDC13243258000FD1E4 /* Build configuration list for PBXProject "UIDickBar" */; 147 | compatibilityVersion = "Xcode 3.2"; 148 | developmentRegion = English; 149 | hasScannedForEncodings = 0; 150 | knownRegions = ( 151 | en, 152 | ); 153 | mainGroup = 7709ADD713243258000FD1E4; 154 | productRefGroup = 7709ADE313243258000FD1E4 /* Products */; 155 | projectDirPath = ""; 156 | projectRoot = ""; 157 | targets = ( 158 | 7709ADE113243258000FD1E4 /* UIDickBar */, 159 | ); 160 | }; 161 | /* End PBXProject section */ 162 | 163 | /* Begin PBXResourcesBuildPhase section */ 164 | 7709ADE013243258000FD1E4 /* Resources */ = { 165 | isa = PBXResourcesBuildPhase; 166 | buildActionMask = 2147483647; 167 | files = ( 168 | 7709ADF113243258000FD1E4 /* InfoPlist.strings in Resources */, 169 | 7709ADFA13243258000FD1E4 /* MainWindow.xib in Resources */, 170 | 7709AE0013243258000FD1E4 /* RootViewController.xib in Resources */, 171 | 7709AE8D132473A6000FD1E4 /* trends-icon.png in Resources */, 172 | 7709AE8E132473A6000FD1E4 /* trends-icon@2x.png in Resources */, 173 | ); 174 | runOnlyForDeploymentPostprocessing = 0; 175 | }; 176 | /* End PBXResourcesBuildPhase section */ 177 | 178 | /* Begin PBXSourcesBuildPhase section */ 179 | 7709ADDE13243258000FD1E4 /* Sources */ = { 180 | isa = PBXSourcesBuildPhase; 181 | buildActionMask = 2147483647; 182 | files = ( 183 | 7709ADF413243258000FD1E4 /* main.m in Sources */, 184 | 7709ADF713243258000FD1E4 /* DemoAppDelegate.m in Sources */, 185 | 7709ADFD13243258000FD1E4 /* RootViewController.m in Sources */, 186 | 7709AE081324331A000FD1E4 /* UIDickBar.m in Sources */, 187 | 241CD29213263BCA00FABBEC /* UIDickBarController.m in Sources */, 188 | ); 189 | runOnlyForDeploymentPostprocessing = 0; 190 | }; 191 | /* End PBXSourcesBuildPhase section */ 192 | 193 | /* Begin PBXVariantGroup section */ 194 | 7709ADEF13243258000FD1E4 /* InfoPlist.strings */ = { 195 | isa = PBXVariantGroup; 196 | children = ( 197 | 7709ADF013243258000FD1E4 /* en */, 198 | ); 199 | name = InfoPlist.strings; 200 | sourceTree = ""; 201 | }; 202 | 7709ADF813243258000FD1E4 /* MainWindow.xib */ = { 203 | isa = PBXVariantGroup; 204 | children = ( 205 | 7709ADF913243258000FD1E4 /* en */, 206 | ); 207 | name = MainWindow.xib; 208 | sourceTree = ""; 209 | }; 210 | 7709ADFE13243258000FD1E4 /* RootViewController.xib */ = { 211 | isa = PBXVariantGroup; 212 | children = ( 213 | 7709ADFF13243258000FD1E4 /* en */, 214 | ); 215 | name = RootViewController.xib; 216 | sourceTree = ""; 217 | }; 218 | /* End PBXVariantGroup section */ 219 | 220 | /* Begin XCBuildConfiguration section */ 221 | 7709AE0113243258000FD1E4 /* Debug */ = { 222 | isa = XCBuildConfiguration; 223 | buildSettings = { 224 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 225 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 226 | GCC_C_LANGUAGE_STANDARD = gnu99; 227 | GCC_OPTIMIZATION_LEVEL = 0; 228 | GCC_PREPROCESSOR_DEFINITIONS = DEBUG; 229 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 230 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 231 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 232 | GCC_WARN_UNUSED_VARIABLE = YES; 233 | IPHONEOS_DEPLOYMENT_TARGET = 4.0; 234 | SDKROOT = iphoneos; 235 | }; 236 | name = Debug; 237 | }; 238 | 7709AE0213243258000FD1E4 /* Release */ = { 239 | isa = XCBuildConfiguration; 240 | buildSettings = { 241 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 242 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 243 | GCC_C_LANGUAGE_STANDARD = gnu99; 244 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 245 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 246 | GCC_WARN_UNUSED_VARIABLE = YES; 247 | IPHONEOS_DEPLOYMENT_TARGET = 4.0; 248 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 249 | SDKROOT = iphoneos; 250 | }; 251 | name = Release; 252 | }; 253 | 7709AE0413243258000FD1E4 /* Debug */ = { 254 | isa = XCBuildConfiguration; 255 | buildSettings = { 256 | ALWAYS_SEARCH_USER_PATHS = NO; 257 | COPY_PHASE_STRIP = NO; 258 | GCC_DYNAMIC_NO_PIC = NO; 259 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 260 | GCC_PREFIX_HEADER = "UIDickBar/UIDickBar-Prefix.pch"; 261 | INFOPLIST_FILE = "UIDickBar/UIDickBar-Info.plist"; 262 | PRODUCT_NAME = "$(TARGET_NAME)"; 263 | WRAPPER_EXTENSION = app; 264 | }; 265 | name = Debug; 266 | }; 267 | 7709AE0513243258000FD1E4 /* Release */ = { 268 | isa = XCBuildConfiguration; 269 | buildSettings = { 270 | ALWAYS_SEARCH_USER_PATHS = NO; 271 | COPY_PHASE_STRIP = YES; 272 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 273 | GCC_PREFIX_HEADER = "UIDickBar/UIDickBar-Prefix.pch"; 274 | INFOPLIST_FILE = "UIDickBar/UIDickBar-Info.plist"; 275 | PRODUCT_NAME = "$(TARGET_NAME)"; 276 | VALIDATE_PRODUCT = YES; 277 | WRAPPER_EXTENSION = app; 278 | }; 279 | name = Release; 280 | }; 281 | /* End XCBuildConfiguration section */ 282 | 283 | /* Begin XCConfigurationList section */ 284 | 7709ADDC13243258000FD1E4 /* Build configuration list for PBXProject "UIDickBar" */ = { 285 | isa = XCConfigurationList; 286 | buildConfigurations = ( 287 | 7709AE0113243258000FD1E4 /* Debug */, 288 | 7709AE0213243258000FD1E4 /* Release */, 289 | ); 290 | defaultConfigurationIsVisible = 0; 291 | defaultConfigurationName = Release; 292 | }; 293 | 7709AE0313243258000FD1E4 /* Build configuration list for PBXNativeTarget "UIDickBar" */ = { 294 | isa = XCConfigurationList; 295 | buildConfigurations = ( 296 | 7709AE0413243258000FD1E4 /* Debug */, 297 | 7709AE0513243258000FD1E4 /* Release */, 298 | ); 299 | defaultConfigurationIsVisible = 0; 300 | defaultConfigurationName = Release; 301 | }; 302 | /* End XCConfigurationList section */ 303 | }; 304 | rootObject = 7709ADD913243258000FD1E4 /* Project object */; 305 | } 306 | -------------------------------------------------------------------------------- /UIDickBar/DemoAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // DemoAppDelegate.h 3 | // UIDickBar 4 | // 5 | // Created by digdog on 3/6/11. 6 | // Copyright 2011 Ching-Lan 'digdog' HUANG. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DemoAppDelegate : NSObject { 12 | 13 | } 14 | 15 | @property (nonatomic, retain) IBOutlet UIWindow *window; 16 | 17 | @property (nonatomic, retain) IBOutlet UINavigationController *navigationController; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /UIDickBar/DemoAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // DemoAppDelegate.m 3 | // UIDickBar 4 | // 5 | // Created by digdog on 3/6/11. 6 | // Copyright 2011 Ching-Lan 'digdog' HUANG. All rights reserved. 7 | // 8 | 9 | #import "DemoAppDelegate.h" 10 | 11 | @implementation DemoAppDelegate 12 | 13 | 14 | @synthesize window=_window; 15 | 16 | @synthesize navigationController=_navigationController; 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 19 | { 20 | // Override point for customization after application launch. 21 | // Add the navigation controller's view to the window and display. 22 | self.window.rootViewController = self.navigationController; 23 | [self.window makeKeyAndVisible]; 24 | return YES; 25 | } 26 | 27 | - (void)applicationWillResignActive:(UIApplication *)application 28 | { 29 | /* 30 | Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 31 | Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 32 | */ 33 | } 34 | 35 | - (void)applicationDidEnterBackground:(UIApplication *)application 36 | { 37 | /* 38 | Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 39 | If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 40 | */ 41 | } 42 | 43 | - (void)applicationWillEnterForeground:(UIApplication *)application 44 | { 45 | /* 46 | Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 47 | */ 48 | } 49 | 50 | - (void)applicationDidBecomeActive:(UIApplication *)application 51 | { 52 | /* 53 | Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 54 | */ 55 | } 56 | 57 | - (void)applicationWillTerminate:(UIApplication *)application 58 | { 59 | /* 60 | Called when the application is about to terminate. 61 | Save data if appropriate. 62 | See also applicationDidEnterBackground:. 63 | */ 64 | } 65 | 66 | - (void)dealloc 67 | { 68 | [_window release]; 69 | [_navigationController release]; 70 | [super dealloc]; 71 | } 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /UIDickBar/RootViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RootViewController.h 3 | // UIDickBar 4 | // 5 | // Created by digdog on 3/6/11. 6 | // Copyright 2011 Ching-Lan 'digdog' HUANG. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "UIDickBarController.h" 11 | 12 | @interface RootViewController : UIDickBarController {} 13 | @end 14 | -------------------------------------------------------------------------------- /UIDickBar/RootViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // RootViewController.m 3 | // UIDickBar 4 | // 5 | // Created by digdog on 3/6/11. 6 | // Copyright 2011 Ching-Lan 'digdog' HUANG. All rights reserved. 7 | // 8 | 9 | #import "RootViewController.h" 10 | 11 | @implementation RootViewController 12 | 13 | - (void)viewDidLoad { 14 | [super viewDidLoad]; 15 | 16 | UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithTitle:@"toggle" style:UIBarButtonItemStyleBordered target:self action:@selector(toggleDickBar:)]; 17 | self.navigationItem.rightBarButtonItem = item; 18 | [item release]; 19 | } 20 | 21 | - (void)loadDickBar { 22 | UIDickBar *db = [[UIDickBar alloc] initWithDickTitle:@"#DickBar" 23 | dickBadge:@"Stupid" 24 | actionBlock:^{ 25 | [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://digdog.tumblr.com"]]; 26 | }]; 27 | self.dickBar = db; 28 | [db release]; 29 | } 30 | 31 | // Override to allow orientations other than the default portrait orientation. 32 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 33 | return YES; 34 | } 35 | 36 | // Customize the number of sections in the table view. 37 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 38 | { 39 | return 1; 40 | } 41 | 42 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 43 | { 44 | return 30; 45 | } 46 | 47 | // Customize the appearance of table view cells. 48 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 49 | { 50 | static NSString *CellIdentifier = @"Cell"; 51 | 52 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 53 | if (cell == nil) { 54 | cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; 55 | } 56 | cell.textLabel.text = @"For God's Sake"; 57 | cell.textLabel.textColor = [UIColor lightGrayColor]; 58 | cell.detailTextLabel.text = @"Do Not Use This Component In Your iOS Apps"; 59 | cell.detailTextLabel.textColor = [UIColor lightGrayColor]; 60 | 61 | // Configure the cell. 62 | return cell; 63 | } 64 | 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /UIDickBar/UIDickBar-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.github.digdog.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | DDog 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | NSMainNibFile 30 | MainWindow 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | UIInterfaceOrientationPortraitUpsideDown 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /UIDickBar/UIDickBar-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'UIDickBar' target in the 'UIDickBar' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iPhone SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /UIDickBar/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /UIDickBar/en.lproj/MainWindow.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1024 5 | 10J567 6 | 1305 7 | 1038.35 8 | 462.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 300 12 | 13 | 14 | YES 15 | IBProxyObject 16 | IBUINavigationController 17 | IBUIViewController 18 | IBUICustomObject 19 | IBUIWindow 20 | IBUINavigationBar 21 | IBUINavigationItem 22 | 23 | 24 | YES 25 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 26 | 27 | 28 | YES 29 | 30 | YES 31 | 32 | 33 | 34 | 35 | YES 36 | 37 | IBFilesOwner 38 | IBCocoaTouchFramework 39 | 40 | 41 | IBFirstResponder 42 | IBCocoaTouchFramework 43 | 44 | 45 | IBCocoaTouchFramework 46 | 47 | 48 | 49 | 1316 50 | 51 | {320, 480} 52 | 53 | 54 | 55 | 56 | 1 57 | MSAxIDEAA 58 | 59 | NO 60 | NO 61 | 62 | IBCocoaTouchFramework 63 | YES 64 | 65 | 66 | 67 | 68 | 1 69 | 1 70 | 71 | IBCocoaTouchFramework 72 | NO 73 | 74 | 75 | 256 76 | {0, 0} 77 | NO 78 | YES 79 | YES 80 | IBCocoaTouchFramework 81 | 82 | 83 | YES 84 | 85 | 86 | 87 | UIDickBar − An Awful Idea 88 | IBCocoaTouchFramework 89 | 90 | 91 | RootViewController 92 | 93 | 94 | 1 95 | 1 96 | 97 | IBCocoaTouchFramework 98 | NO 99 | 100 | 101 | 102 | 103 | 104 | 105 | YES 106 | 107 | 108 | delegate 109 | 110 | 111 | 112 | 4 113 | 114 | 115 | 116 | window 117 | 118 | 119 | 120 | 5 121 | 122 | 123 | 124 | navigationController 125 | 126 | 127 | 128 | 15 129 | 130 | 131 | 132 | 133 | YES 134 | 135 | 0 136 | 137 | 138 | 139 | 140 | 141 | 2 142 | 143 | 144 | YES 145 | 146 | 147 | 148 | 149 | -1 150 | 151 | 152 | File's Owner 153 | 154 | 155 | 3 156 | 157 | 158 | 159 | 160 | -2 161 | 162 | 163 | 164 | 165 | 9 166 | 167 | 168 | YES 169 | 170 | 171 | 172 | 173 | 174 | 175 | 11 176 | 177 | 178 | 179 | 180 | 13 181 | 182 | 183 | YES 184 | 185 | 186 | 187 | 188 | 189 | 14 190 | 191 | 192 | 193 | 194 | 195 | 196 | YES 197 | 198 | YES 199 | -1.CustomClassName 200 | -2.CustomClassName 201 | 11.IBPluginDependency 202 | 13.CustomClassName 203 | 13.IBPluginDependency 204 | 2.IBAttributePlaceholdersKey 205 | 2.IBEditorWindowLastContentRect 206 | 2.IBPluginDependency 207 | 3.CustomClassName 208 | 3.IBPluginDependency 209 | 9.IBEditorWindowLastContentRect 210 | 9.IBPluginDependency 211 | 212 | 213 | YES 214 | UIApplication 215 | UIResponder 216 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 217 | RootViewController 218 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 219 | 220 | YES 221 | 222 | 223 | 224 | {{673, 376}, {320, 480}} 225 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 226 | DemoAppDelegate 227 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 228 | {{186, 376}, {320, 480}} 229 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 230 | 231 | 232 | 233 | YES 234 | 235 | 236 | 237 | 238 | 239 | YES 240 | 241 | 242 | 243 | 244 | 16 245 | 246 | 247 | 248 | YES 249 | 250 | DemoAppDelegate 251 | NSObject 252 | 253 | YES 254 | 255 | YES 256 | navigationController 257 | window 258 | 259 | 260 | YES 261 | UINavigationController 262 | UIWindow 263 | 264 | 265 | 266 | YES 267 | 268 | YES 269 | navigationController 270 | window 271 | 272 | 273 | YES 274 | 275 | navigationController 276 | UINavigationController 277 | 278 | 279 | window 280 | UIWindow 281 | 282 | 283 | 284 | 285 | IBProjectSource 286 | ./Classes/DemoAppDelegate.h 287 | 288 | 289 | 290 | RootViewController 291 | UIViewController 292 | 293 | tableView 294 | UITableView 295 | 296 | 297 | tableView 298 | 299 | tableView 300 | UITableView 301 | 302 | 303 | 304 | IBProjectSource 305 | ./Classes/RootViewController.h 306 | 307 | 308 | 309 | 310 | 0 311 | IBCocoaTouchFramework 312 | 313 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 314 | 315 | 316 | 317 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 318 | 319 | 320 | YES 321 | 3 322 | 300 323 | 324 | 325 | -------------------------------------------------------------------------------- /UIDickBar/en.lproj/RootViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 784 5 | 10J567 6 | 1305 7 | 1038.35 8 | 462.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 300 12 | 13 | 14 | YES 15 | IBProxyObject 16 | IBUIView 17 | IBUITableView 18 | 19 | 20 | YES 21 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 22 | 23 | 24 | YES 25 | 26 | YES 27 | 28 | 29 | 30 | 31 | YES 32 | 33 | IBFilesOwner 34 | IBCocoaTouchFramework 35 | 36 | 37 | IBFirstResponder 38 | IBCocoaTouchFramework 39 | 40 | 41 | 42 | 292 43 | 44 | YES 45 | 46 | 47 | 274 48 | {320, 460} 49 | 50 | 51 | 52 | 3 53 | MQA 54 | 55 | NO 56 | YES 57 | NO 58 | 59 | 3 60 | 3 61 | 62 | IBCocoaTouchFramework 63 | NO 64 | 1 65 | 0 66 | YES 67 | 44 68 | 22 69 | 22 70 | 71 | 72 | {320, 460} 73 | 74 | 75 | 76 | 3 77 | MQA 78 | 79 | 2 80 | 81 | 82 | IBCocoaTouchFramework 83 | 84 | 85 | 86 | 87 | YES 88 | 89 | 90 | dataSource 91 | 92 | 93 | 94 | 4 95 | 96 | 97 | 98 | delegate 99 | 100 | 101 | 102 | 5 103 | 104 | 105 | 106 | view 107 | 108 | 109 | 110 | 9 111 | 112 | 113 | 114 | tableView 115 | 116 | 117 | 118 | 10 119 | 120 | 121 | 122 | 123 | YES 124 | 125 | 0 126 | 127 | 128 | 129 | 130 | 131 | -1 132 | 133 | 134 | File's Owner 135 | 136 | 137 | -2 138 | 139 | 140 | 141 | 142 | 8 143 | 144 | 145 | YES 146 | 147 | 148 | 149 | 150 | 151 | 2 152 | 153 | 154 | 155 | 156 | 157 | 158 | YES 159 | 160 | YES 161 | -1.CustomClassName 162 | -2.CustomClassName 163 | 2.IBEditorWindowLastContentRect 164 | 2.IBPluginDependency 165 | 8.IBPluginDependency 166 | 167 | 168 | YES 169 | RootViewController 170 | UIResponder 171 | {{144, 609}, {320, 247}} 172 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 173 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 174 | 175 | 176 | 177 | YES 178 | 179 | 180 | 181 | 182 | 183 | YES 184 | 185 | 186 | 187 | 188 | 10 189 | 190 | 191 | 192 | YES 193 | 194 | RootViewController 195 | UIViewController 196 | 197 | tableView 198 | UITableView 199 | 200 | 201 | tableView 202 | 203 | tableView 204 | UITableView 205 | 206 | 207 | 208 | IBProjectSource 209 | ./Classes/RootViewController.h 210 | 211 | 212 | 213 | 214 | 0 215 | IBCocoaTouchFramework 216 | 217 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 218 | 219 | 220 | 221 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 222 | 223 | 224 | YES 225 | 3 226 | 300 227 | 228 | 229 | -------------------------------------------------------------------------------- /UIDickBar/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // UIDickBar 4 | // 5 | // Created by digdog on 3/6/11. 6 | // Copyright 2011 Ching-Lan 'digdog' HUANG. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | [pool release]; 16 | return retVal; 17 | } 18 | -------------------------------------------------------------------------------- /UIDickBarController.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIDickBarController.h 3 | // UIDickBar 4 | // 5 | // Created by Daniel Tull on 08.03.2011. 6 | // Copyright 2011 Daniel Tull. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "UIDickBar.h" 11 | 12 | @interface UIDickBarController : UIViewController { 13 | BOOL dickBarShowing; 14 | } 15 | 16 | @property (nonatomic, retain) IBOutlet UIDickBar *dickBar; 17 | @property (nonatomic, retain) IBOutlet UITableView *tableView; 18 | 19 | - (void)loadTableView; 20 | - (void)loadDickBar; 21 | 22 | - (IBAction)toggleDickBar:(id)sender; 23 | - (void)hideDickBar; 24 | - (void)showDickBar; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /UIDickBarController.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIDickBarController.m 3 | // UIDickBar 4 | // 5 | // Created by Daniel Tull on 08.03.2011. 6 | // Copyright 2011 Daniel Tull. All rights reserved. 7 | // 8 | 9 | #import "UIDickBarController.h" 10 | 11 | 12 | @implementation UIDickBarController 13 | 14 | @synthesize tableView, dickBar; 15 | 16 | - (void)dealloc { 17 | [tableView release], tableView = nil; 18 | [dickBar release], dickBar = nil; 19 | [super dealloc]; 20 | } 21 | 22 | #pragma mark - UIDickBarController 23 | 24 | - (void)loadTableView {} 25 | 26 | - (UITableView *)tableView { 27 | 28 | if (!(tableView)) [self loadTableView]; 29 | 30 | if (!(tableView)) { 31 | tableView = [[UITableView alloc] initWithFrame:self.view.bounds 32 | style:UITableViewStylePlain]; 33 | } 34 | 35 | return [[tableView retain] autorelease]; 36 | } 37 | 38 | - (void)loadDickBar {} 39 | 40 | - (UIDickBar *)dickBar { 41 | 42 | if (!(dickBar)) [self loadDickBar]; 43 | 44 | if (!(dickBar)) { 45 | dickBar = [[UIDickBar alloc] initWithDickTitle:@"Dick Bar" 46 | dickBadge:@"Badge" 47 | actionBlock:nil]; 48 | } 49 | 50 | return [[dickBar retain] autorelease]; 51 | } 52 | 53 | - (IBAction)toggleDickBar:(id)sender { 54 | 55 | if (dickBarShowing) 56 | [self hideDickBar]; 57 | else 58 | [self showDickBar]; 59 | } 60 | 61 | - (void)hideDickBar { 62 | 63 | UIView *v = self.tableView.tableHeaderView; 64 | 65 | if ([self.dickBar.superview isEqual:v]) { 66 | 67 | NSArray *subviews = [v.subviews retain]; 68 | 69 | for (UIView *s in subviews) 70 | [s removeFromSuperview]; 71 | 72 | v.frame = CGRectMake(v.frame.origin.x, v.frame.origin.y, v.frame.size.width, v.frame.size.height - 44.0f); 73 | 74 | for (UIView *s in subviews) { 75 | s.frame = CGRectMake(s.frame.origin.x, s.frame.origin.y - 44.0f, s.frame.size.width, s.frame.size.height); 76 | [v addSubview:s]; 77 | } 78 | 79 | [subviews release]; 80 | 81 | self.tableView.tableHeaderView = v; 82 | 83 | } else { 84 | 85 | [self.dickBar removeFromSuperview]; 86 | } 87 | 88 | dickBarShowing = NO; 89 | } 90 | 91 | - (void)showDickBar { 92 | 93 | if (self.tableView.contentOffset.y > self.dickBar.bounds.size.height) 94 | [self.dickBar showInView:self.view]; 95 | 96 | else { 97 | 98 | UIView *v = self.tableView.tableHeaderView; 99 | 100 | if (!(v)) { 101 | UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.view.frame.size.width, 0.0f)]; 102 | self.tableView.tableHeaderView = view; 103 | [view release]; 104 | } 105 | 106 | v = self.tableView.tableHeaderView; 107 | 108 | NSArray *subviews = [v.subviews retain]; 109 | 110 | for (UIView *s in subviews) 111 | [s removeFromSuperview]; 112 | 113 | v.frame = CGRectMake(v.frame.origin.x, v.frame.origin.y, v.frame.size.width, v.frame.size.height + 44.0f); 114 | 115 | for (UIView *s in subviews) { 116 | s.frame = CGRectMake(s.frame.origin.x, s.frame.origin.y + 44.0f, s.frame.size.width, s.frame.size.height); 117 | [v addSubview:s]; 118 | } 119 | 120 | [subviews release]; 121 | 122 | [self.dickBar showInView:v]; 123 | self.tableView.tableHeaderView = v; 124 | } 125 | 126 | dickBarShowing = YES; 127 | } 128 | 129 | #pragma mark - UIViewController 130 | 131 | - (void)viewDidLoad { 132 | [super viewDidLoad]; 133 | [self showDickBar]; 134 | } 135 | 136 | - (void)viewDidUnload { 137 | [super viewDidUnload]; 138 | self.tableView = nil; 139 | self.dickBar = nil; 140 | } 141 | 142 | #pragma mark - UITableViewDataSource 143 | 144 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 145 | return 0; 146 | } 147 | 148 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 149 | return nil; 150 | } 151 | 152 | @end 153 | -------------------------------------------------------------------------------- /trends-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digdog/UIDickBar/461f4c3b6f6f990f61bf2e9dc28020dc65c947d7/trends-icon.png -------------------------------------------------------------------------------- /trends-icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digdog/UIDickBar/461f4c3b6f6f990f61bf2e9dc28020dc65c947d7/trends-icon@2x.png --------------------------------------------------------------------------------