block函数回调

来源:互联网 发布:航天飞机 知乎 编辑:程序博客网 时间:2024/05/07 19:32

- (void)viewDidLoad

{

    

    // Uncomment the following line to preserve selection between presentations.

    // self.clearsSelectionOnViewWillAppear = NO;

    

    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.

    // self.navigationItem.rightBarButtonItem = self.editButtonItem;

    

   [superviewDidLoad];

实现在次    

[self testFunction:^(int x){

        NSLog(@"excute block function over"); //block执行结束

        NSLog(@"%d",x);

    }];

    self.app = [UIApplicationsharedApplication].delegate;

     [self initBarUI];


    

}

// 申明在次

-(void)testFunction:(void(^)(int x))finishBlock

{

    NSLog(@"excute internal function."); //执行子函数

   调用在此

    finishBlock(6);

  

}

0 0
原创粉丝点击