Giter Club home page Giter Club logo

bblock's Introduction

##BBNSButton.h

###@interface BBNSButton : NSButton

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;

##BBlock.h

###@interface BBlock : NSObject

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;

##NSApplication+BBlock.h

###@interface NSApplication (BBlock)

- (void)beginSheet:(NSWindow*)sheet modalForWindow:(NSWindow*)modalWindow completionHandler:(void (^)(NSInteger returnCode))handler;

##NSArray+BBlock.h

###@interface NSArray(BBlock)

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;

##NSButton+BBlock.h

###@interface NSButton(BBlock)

WARNING: This category is still in early development. Currently the order of calling these methods is important:

  1. setImage
  2. setAlternateBackgroundImage
  3. 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;

##NSDictionary+BBlock.h

###@interface NSDictionary(BBlock)

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;

##NSImage+BBlock.h

###@interface NSImage(BBlock)

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;

##NSObject+BBlock.h

###@interface NSObject(BBlock)

- (NSString *)addObserverForKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options block:(NSObjectBBlock)block;
- (void)removeObserverForToken:(NSString *)identifier;

##NSTimer+BBlock.h

###@interface NSTimer(BBlock)

+ (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;

##NSURL+BBlock.h

###@interface NSURL(BBlock)

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;

##SKProductsRequest+BBlock.h

###@interface SKProductsRequest(BBlock)

Request a StoreKit response for a set of product identifiers

+ (id)requestWithProductIdentifiers:(NSSet *)productIdentifiers andBlock:(SKProductsRequestBBlock)block;
- (id)initWithProductIdentifiers:(NSSet *)productIdentifiers andBlock:(SKProductsRequestBBlock)block;

##UIActionSheet+BBlock.h

###@interface UIActionSheet(BBlock)

- (void)setCompletionBlock:(UIActionSheetBBlock)block;
- (id)initWithTitle:(NSString *)title cancelButtonTitle:(NSString *)cancelTitle destructiveButtonTitle:(NSString *)destructiveTitle otherButtonTitle:(NSString *)otherTitle completionBlock:(UIActionSheetBBlock)block;

##UIAlertView+BBlock.h

###@interface UIAlertView(BBlock)

- (void)setCompletionBlock:(UIAlertViewBBlock)block;
- (id)initWithTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelTitle otherButtonTitle:(NSString *)otherButtonTitle completionBlock:(UIAlertViewBBlock)block;

##UIButton+BBlock.h

###@interface UIButton(BBlock)

- (void)addActionForControlEvents:(UIControlEvents)events withBlock:(BBlockUIButtonBlock)block;

##UIGestureRecognizer+BBlock.h

###@interface UISwipeGestureRecognizer(BBlock)

- (id)initWithDirection:(UISwipeGestureRecognizerDirection)direction andBlock:(UIGestureRecognizerBBlock)block;
+ (id)gestureWithDirection:(UISwipeGestureRecognizerDirection)direction andBlock:(UIGestureRecognizerBBlock)block;

###@interface UIGestureRecognizer(BBlock)

- (id)initWithBlock:(UIGestureRecognizerBBlock)block;
+ (id)gestureWithBlock:(UIGestureRecognizerBBlock)block;

##UIImage+BBlock.h

###@interface UIImage(BBlock)

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;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.