Skip to content

Commit

Permalink
Improved ActivityView Design for iPhone
Browse files Browse the repository at this point in the history
  • Loading branch information
mmackh committed Jul 16, 2013
1 parent bac3c78 commit b67295a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Hacker News/MAMActivityViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#import <Foundation/Foundation.h>

@interface MAMActivityViewController : NSObject
@interface MAMActivityViewController : UIActivityViewController

+ (UIActivityViewController*)controllerForURL:(NSURL*)URL;

Expand Down
30 changes: 29 additions & 1 deletion Hacker News/MAMActivityViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

#import "MAMActivityViewController.h"
#import "NSString+Additions.h"

// UIActivities
#import "PocketAPIActivity.h"
Expand All @@ -33,9 +34,36 @@ + (UIActivityViewController*)controllerForURL:(NSURL*)URL
MAMInstapaperActivity *instapaperActivity = [[MAMInstapaperActivity alloc] init];
[activities addObject:instapaperActivity];
}
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[URL] applicationActivities:activities];
UIActivityViewController *activityViewController = [[super alloc] initWithActivityItems:@[URL] applicationActivities:activities];
[activityViewController setExcludedActivityTypes:@[UIActivityTypePostToWeibo]];
return activityViewController;
}

- (void)viewDidLayoutSubviews
{
[super viewDidLayoutSubviews];

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) return;
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) return;
NSString *cls = [@"VUlBY3Rpdml0eUNhbmNlbEJ1dHRvbg==" base64Decode];
for (id view in [[self.view.subviews objectAtIndex:0] subviews]) {
if ([view isKindOfClass:[UIImageView class]])
{
UIImageView *background = view;
[background setImage:[[UIImage alloc] init]];
[background setBackgroundColor:[UIColor colorWithWhite:0.1 alpha:0.9]];
}
if ([view isKindOfClass:NSClassFromString(cls)])
{
for (id subview in [view subviews])
{
if ([subview isKindOfClass:[UIImageView class]])
{
[subview removeFromSuperview];
}
}
}
}
}

@end

0 comments on commit b67295a

Please sign in to comment.