iOSBlocks 1.2

iOSBlocks 1.2

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布最新发布2016年4月

未声明的维护。



  • 作者:
  • Ignacio Romero Z.

iOS Blocks

代理真的很让人头疼。Objective-C blocks很强大!这是我为简化基本iOS框架和API实现而创建的一些类别类,无需使用代理。

安装

Cocoa Pods中可用

pod 'iOSBlocks', '~> 1.0.2', :inhibit_warnings => true

(您应该添加'inhibit_warnings'标志以避免一些即将修复的现有警告)

然后根据需要导入库,或者在您应用程序的Prefix.pch文件中。

#import "iOSBlocks.h"

一些示例

UINavigationController

- (void)pushViewController:(UIViewController *)viewController
                  animated:(BOOL)animated
              onCompletion:(VoidBlock)completion;

&

- (void)popViewControllerAnimated:(BOOL)animated
                     onCompletion:(VoidBlock)completion;

UIPopoverController

+ (UIPopoverController *)popOverWithContentViewController:(UIViewController *)controller
                                               showInView:(UIView *)view
                                          onShouldDismiss:(VoidBlock)shouldDismiss
                                                 onCancel:(CancelBlock)cancelled;

UIAlertView

+ (UIAlertView *)alertViewWithTitle:(NSString *)title
                            message:(NSString *)message
                  cancelButtonTitle:(NSString *)cancelButtonTitle
                  otherButtonTitles:(NSArray *)otherButtons
                          onDismiss:(DismissBlock)dismissed
                           onCancel:(CancelBlock)cancelled;

UIActionSheet

+ (UIActionSheet *)actionSheetWithTitle:(NSString *)title
                                  style:(UIActionSheetStyle)sheetStyle
                      cancelButtonTitle:(NSString *)cancelButtonTitle
                           buttonTitles:(NSArray *)buttonTitles
                         disabledTitles:(NSArray *)disabledTitles
                             showInView:(UIView *)view
                              onDismiss:(DismissBlock)dismissed
                               onCancel:(CancelBlock)cancelled;

MFMailComposeViewController

+ (void)mailWithSubject:(NSString *)subject
                message:(NSString *)message
             recipients:(NSArray *)recipients
         andAttachments:(NSArray *)attachments
             onCreation:(ComposeCreatedBlock)creation
               onFinish:(ComposeFinishedBlock)finished;

MFMessageComposeViewController

+ (void)messageWithBody:(NSString *)body
             recipients:(NSArray *)recipients
             onCreation:(ComposeCreatedBlock)creation
               onFinish:(ComposeFinishedBlock)finished;

NSURLConnection

+ (NSURLConnection *)sendAsynchronousRequest:(NSURLRequest *)request
                           didUpdateProgress:(ProgressBlock)progress
                              didReceiveData:(DataBlock)data
                          didReceiveResponse:(SuccessBlock)success
                            didFailWithError:(FailureBlock)fail;

CLLocation

+ (void)updateLocationWithDistanceFilter:(CLLocationDistance)filter
                      andDesiredAccuracy:(CLLocationAccuracy)accuracy
            didChangeAuthorizationStatus:(StatusBlock)status
                      didUpdateLocations:(LocationBlock)located
                        didFailWithError:(FailureBlock)failed;

等等。享受吧!

示例项目

查看示例项目。一切都在那里。
享受并与他人合作改进此库。

许可证

(MIT许可证)

版权所有©2012 Ignacio Romero Zurbuchen [email protected]

任何获得此软件及其相关文档文件(“软件”)副本的人(“许可人”)在此授予许可,无需支付费用,允许任何人在不受限制的情况下处理该软件,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或出售软件副本,并允许有权获得软件的人这样做,前提是以下条件

上述版权声明和本许可声明应包含在软件的所有副本或实质性部分中。