2016-03-10 自己的block1

a.h 中:

typedef void (^ReturnAmountBlock)(NSString *showText);

 

@interface amoutViewcontroller : UIViewController

 

@property (nonatomic, copy) ReturnAmountBlock returnTextBlock;

 

- (void)returnAmountText:(ReturnAmountBlock)block;

2:a.m  中

- (void)returnAmountText:(ReturnAmountBlock)block{

    self.returnTextBlock=[block copy]; //1 创建

}

点击方法:

{

if (self.returnTextBlock != nil) {

            self.returnTextBlock(amountField.text);//把值闯过去 2 赋值

        }

 

}

pop 过去

 

3:b.m

 

 amoutViewcontroller *amoutn=[amoutViewcontroller new];

        [amoutn returnAmountText:^(NSString *showText) {

            _donateAmounts=showText;//执行 3

             [juanzhuInfoTv reloadRowsAtIndexPaths:@[_amountIndexpath] withRowAnimation:UITableViewRowAnimationNone];

        }];

        amoutn.hidesBottomBarWhenPushed=YES;

        [self.navigationController pushViewController:amoutn animated:YES];

 

 

 

posted @ 2016-03-10 10:48  zhen_zhen  阅读(120)  评论(0编辑  收藏  举报