Skip to content

Instantly share code, notes, and snippets.

Mike Abdullah mikeabdullah

Block or report user

Report or block mikeabdullah

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mikeabdullah
mikeabdullah / NSResponder.h
Created Aug 18, 2015
NSResponder: Supplement targets
View NSResponder.h
@interface NSResponder
- (id)supplementalTargetForAction:(SEL)action sender:(id)sender NS_AVAILABLE_MAC(10_7);
@end
@mikeabdullah
mikeabdullah / actiondispatch.m
Created Aug 18, 2015
Example of custom action dispatch on iOS
View actiondispatch.m
id target = [self targetForAction:@selector(myAction:) sender:self];
[target myAction:self];
@mikeabdullah
mikeabdullah / UIResponder.h
Last active Aug 29, 2015
Some of UIResponder
View UIResponder.h
@interface UIResponder
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender;
- (id)targetForAction:(SEL)action withSender:(id)sender NS_AVAILABLE_IOS(7_0);
@end
@interface UIApplication
- (BOOL)sendAction:(SEL)action to:(id)target from:(id)sender forEvent:(UIEvent *)event;
@end
@mikeabdullah
mikeabdullah / NSResponder.h
Last active Aug 29, 2015
Some of NSResponder
View NSResponder.h
@interface NSResponder
- (BOOL)tryToPerform:(SEL)anAction with:(id)anObject;
- (void)doCommandBySelector:(SEL)aSelector;
@end
@interface NSApplication
- (BOOL)sendAction:(SEL)theAction to:(id)theTarget from:(id)sender;
- (id)targetForAction:(SEL)theAction to:(id)theTarget from:(id)sender;
@end
@mikeabdullah
mikeabdullah / gist:d767d593bfbdf74913d3
Created Jul 9, 2015
Disabling Vibrancy for an NSPopover
View gist:d767d593bfbdf74913d3
- (void)disableVibrancyForPopover:(NSPopover *)popover {
NSAppearance *appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua];
popover.appearance = appearance;
}
View gist:af8be11f4aa1ac7b6234
- (NSURL *)URLFromWeblocFileData:(NSData *)data {
NSDictionary *dict = [NSPropertyListSerialization propertyListWithData:data
options:NSPropertyListImmutable
format:NULL
error:NULL];
NSString *urlString = dict[@"URL"];
return [NSURL URLWithString:urlString];
}
@mikeabdullah
mikeabdullah / gist:2a7e49d54b95826ddda9
Created Jul 2, 2015
Locating child View Controllers based on containing view
View gist:2a7e49d54b95826ddda9
- (void)viewDidLoad {
[super viewDidLoad];
for (NSViewController *aController in self.childViewControllers) {
if ([aController.view isDescendantOf:self.containerView]) {
self.contentViewController = aController;
}
}
}
@mikeabdullah
mikeabdullah / gist:f67640ffadb65cb13766
Created Jul 2, 2015
Locating child View Controllers based on restoration identifier
View gist:f67640ffadb65cb13766
- (void)viewDidLoad {
[super viewDidLoad];
for (NSViewController *aController in self.childViewControllers) {
NSString *identifier = [aController identifier];
if ([identifier isEqualToString:@"master"]) {
self.masterViewController = aController;
}
else if ([identifier isEqualToString:@"detail"]) {
self.detailViewController = aController;
@mikeabdullah
mikeabdullah / gist:885231145a28dacbf964
Created Jun 2, 2015
Referencing a contained view controller on iOS
View gist:885231145a28dacbf964
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"contained"]) {
self.contentViewController = segue.destinationViewController;
}
}
@mikeabdullah
mikeabdullah / gist:365a450389bf88ade24c
Created Jun 2, 2015
Referencing view controllers from a storyboard
View gist:365a450389bf88ade24c
- (void)windowDidLoad {
NSSplitViewController *splitViewController = (NSSplitViewController *)self.rootViewController;
self.masterViewController = (MyMasterViewController *)splitViewController.childViewControllers[0];
self.detailViewController = (MyDetailViewController *)splitViewController.detailViewControllers[1];
}
You can’t perform that action at this time.