TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Sep 2015 |
Maintained by David Keegan.
Set the callback block to be called when the mouse enters the button.
- (void)setInCallback:(BBNSButtonCallback)block;
Set the callback block to be called when the mouse exits the button.
- (void)setOutCallback:(BBNSButtonCallback)block;
Set both the enter* and **exit callback blocks.
- (void)setInCallback:(BBNSButtonCallback)inBlock andOutCallback:(BBNSButtonCallback)outBlock;
For when you need a weak reference of an object, example: BBlockWeakObject(obj) wobj = obj;
For when you need a weak reference to self, example: BBlockWeakSelf wself = self;
Execute the block on the main thread
+ (void)dispatchOnMainThread:(void (^)())block;
Exectute the block on a background thread but in a synchronous queue
+ (void)dispatchOnSynchronousQueue:(void (^)())block;
Exectute the block on a background thread but in a synchronous queue,
This queue should only be used for writing files to disk.
+ (void)dispatchOnSynchronousFileQueue:(void (^)())block;
+ (void)dispatchOnDefaultPriorityConcurrentQueue:(void (^)())block;
+ (void)dispatchOnLowPriorityConcurrentQueue:(void (^)())block;
+ (void)dispatchOnHighPriorityConcurrentQueue:(void (^)())block;
- (void)beginSheet:(NSWindow*)sheet modalForWindow:(NSWindow*)modalWindow completionHandler:(void (^)(NSInteger returnCode))handler;
Enumerate each object in the array.
- (void)enumerateEachObjectUsingBlock:(void(^)(id obj))block;
Apply the block to each object in the array and return an array of resulting objects
- (NSArray *)arrayWithObjectsMappedWithBlock:(id(^)(id obj))block;
WARNING: This category is still in early development. Currently the order of calling these methods is important:
setImage
setAlternateBackgroundImage
setBackgroundImage
Tries to mimic UIButton
by exposing a method to set the background image.
The image set with setImage
is composited on-top of the background image.
- (void)setBackgroundImage:(NSImage *)backgroundImage;
Tries to mimic UIButton
by exposing a method to set the alternate background image.
The image set with setAlternateImage
is composited on-top of the alternate background image.
If no alternateImage
is set image
will be used instead.
- (void)setAlternateBackgroundImage:(NSImage *)alternateBackgroundImage;
Enumerate each key and object in the dictioanry.
- (void)enumerateEachKeyAndObjectUsingBlock:(void(^)(id key, id obj))block;
- (void)enumerateEachSortedKeyAndObjectUsingBlock:(void(^)(id key, id obj, NSUInteger idx))block;
Returns a NSImage
rendered with the drawing code in the block.
This method does not cache the image object.
+ (NSImage *)imageForSize:(NSSize)size withDrawingBlock:(void(^)())drawingBlock;
Returns a cached NSImage
rendered with the drawing code in the block.
The NSImage
is cached in an NSCache
with the identifier provided.
+ (NSImage *)imageWithIdentifier:(NSString *)identifier forSize:(NSSize)size andDrawingBlock:(void(^)())drawingBlock;
- (NSString *)addObserverForKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options block:(NSObjectBBlock)block;
- (void)removeObserverForToken:(NSString *)identifier;
+ (id)timerWithTimeInterval:(NSTimeInterval)timeInterval andBlock:(void (^)())block;
+ (id)timerRepeats:(BOOL)repeats withTimeInterval:(NSTimeInterval)timeInterval andBlock:(void (^)())block;
+ (id)scheduledTimerWithTimeInterval:(NSTimeInterval)timeInterval andBlock:(void (^)())block;
+ (id)scheduledTimerRepeats:(BOOL)repeats withTimeInterval:(NSTimeInterval)timeInterval andBlock:(void (^)())block;
Access a security scoped bookmark for sandboxed mac apps.
This method starts the access, runs the block, then stops the access.
-(void)accessSecurityScopedResourceWithBlock:(void (^)())block;
Run NSAlert as sheet for window with completion handler block.
-(void)beginSheetModalForWindow:(NSWindow *)window completionHandler:(void (^)(NSInteger returnCode))handler contextInfo:(void *)contextInfo;
Request a StoreKit response for a set of product identifiers
+ (id)requestWithProductIdentifiers:(NSSet *)productIdentifiers andBlock:(SKProductsRequestBBlock)block;
- (id)initWithProductIdentifiers:(NSSet *)productIdentifiers andBlock:(SKProductsRequestBBlock)block;
- (void)setCompletionBlock:(UIActionSheetBBlock)block;
- (id)initWithTitle:(NSString *)title cancelButtonTitle:(NSString *)cancelTitle destructiveButtonTitle:(NSString *)destructiveTitle otherButtonTitle:(NSString *)otherTitle completionBlock:(UIActionSheetBBlock)block;
- (void)setCompletionBlock:(UIAlertViewBBlock)block;
- (id)initWithTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelTitle otherButtonTitle:(NSString *)otherButtonTitle completionBlock:(UIAlertViewBBlock)block;
- (void)addActionForControlEvents:(UIControlEvents)events withBlock:(BBlockUIButtonBlock)block;
- (id)initWithDirection:(UISwipeGestureRecognizerDirection)direction andBlock:(UIGestureRecognizerBBlock)block;
+ (id)gestureWithDirection:(UISwipeGestureRecognizerDirection)direction andBlock:(UIGestureRecognizerBBlock)block;
- (id)initWithBlock:(UIGestureRecognizerBBlock)block;
+ (id)gestureWithBlock:(UIGestureRecognizerBBlock)block;
Returns a UIImage
rendered with the drawing code in the block.
This method does not cache the image object.
+ (UIImage *)imageForSize:(CGSize)size withDrawingBlock:(void(^)())drawingBlock;
+ (UIImage *)imageForSize:(CGSize)size opaque:(BOOL)opaque withDrawingBlock:(void(^)())drawingBlock;
Returns a cached UIImage
rendered with the drawing code in the block.
The UIImage
is cached in an NSCache
with the identifier provided.
+ (UIImage *)imageWithIdentifier:(NSString *)identifier forSize:(CGSize)size andDrawingBlock:(void(^)())drawingBlock;
+ (UIImage *)imageWithIdentifier:(NSString *)identifier opaque:(BOOL)opaque forSize:(CGSize)size andDrawingBlock:(void(^)())drawingBlock;