Home > Web Front-end > HTML Tutorial > Use block to transfer values ​​between two pages_html/css_WEB-ITnose

Use block to transfer values ​​between two pages_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:01:26
Original
1229 people have browsed it

The second view declares a block property:

@property (nonatomic, copy) void(^doTransferMsg)(NSString *_msg);

Then check whether the block exists in the value transfer method

- (IBAction)transferText:(UIButton *)sender {
if (_doTransferMsg) {
_doTransferMsg(@"hello there" );
_doTransferMsg = nil;
}
[self.navigationController popViewControllerAnimated:YES];
}

In the main View, when creating the second view, By the way, implement this block

- (IBAction)LoadDetailView:(UIButton *)sender {
[ibTextLabel setText:nil];
DetailViewController *_curDetail = [[DetailViewController alloc] initWithNibName:@ "DetailViewController"
                                                                         *_msg) {
dispatch_async(dispatch_get_main_queue(), ^{
[ibTextLabel setText:_msg];
} );
}];
[self.navigationController pushViewController:_curDetail
🎜>

that's all

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template