Uploaded October 2012 | Updated September 2026, 2 weeks ago
Subscribe to our channel here for notifications on new video trainings. For more videos on technology, visit our website at http://www.techytube.com.
By pavel@techytube, for more from this author visit:
techytube.com/author/pavel
Block objects provide a way for you to create an ad hoc function body as an expression in C, and C-derived languages such as Objective-C and C++. In other languages and environments, a block object is sometimes also called a "closure". Here, they are typically referred as "blocks", unless there is scope for confusion with the standard C term for a block of code.
You use the ^ operator to declare a block variable and to indicate the beginning of a block literal. The body of the block itself is contained within {}, as shown in this example (as usual with C, ; indicates the end of the statement):
int multiplier = 7;
int (^myBlock)(int) = ^(int num) {
return num * multiplier;
};
Notice that the block is able to make use of variables from the same scope in which it was defined.
If you declare a block as a variable, you can then use it just as you would a function:
int multiplier = 5;
int (^myBlock)(int) = ^(int num) {
return num * multiplier;
};
int result = myBlock(4);
NSLog(@"result = %d", result); // will output "result = 20"
You can find more about blocks on the following web page:
developer.apple.com/library/ios/#documentation/cocoa/Conceptual/Blocks/Articles/00_Introduction.html
Subscribe to our channel here for notifications on new video trainings. For more videos on technology, visit our website at http://www.techytube.com.
By pavel@techytube, for more from this author visit:
techytube.com/author/pavel
Block objects provide a way for you to create an ad hoc function body as an expression in C, and C-derived languages such as Objective-C and C++. In other languages and environments, a block object is sometimes also called a "closure". Here, they are typically referred as "blocks", unless there is scope for confusion with the standard C term for a block of code.
You use the ^ operator to declare a block variable and to indicate the beginning of a block literal. The body of the block itself is contained within {}, as shown in this example (as usual with C, ; indicates the end of the statement):
int multiplier = 7;
int (^myBlock)(int) = ^(int num) {
return num * multiplier;
};
Notice that the block is able to make use of variables from the same scope in which it was defined.
If you declare a block as a variable, you can then use it just as you would a function:
int multiplier = 5;
int (^myBlock)(int) = ^(int num) {
return num * multiplier;
};
int result = myBlock(4);
NSLog(@"result = %d", result); // will output "result = 20"
You can find more about blocks on the following web page:
developer.apple.com/library/ios/#documentation/cocoa/Conceptual/Blocks/Articles/00_Introduction.html



![Windows 8 Development - XAML DefaultViewModel Binding
Subscribe to our channel here for notifications on new video trainings. For more videos on technology, visit our website at http://www.techytube.com.
By mzmuda@techytube, for more from this author visit:
http://www.techytube.com/author/mzmuda
Next were going to hook up the UI for our main application page through the DefaultViewModel collection.
A page of type Items has a default View Model defined, and it is possible to hook up to a data source with only a few lines of code.
Once done, the page will render the items in the default template format. Of course,customization will likely take place from the default settings.
In this video, I will show you how to bind our data feeds to the DefaultViewModel[Items] element of our ItemsPage.
References
XAML Blog Reader - http://msdn.microsoft.com/en-us/library/windows/apps/br211380.aspx Windows 8 Development - XAML DefaultViewModel Binding](https://i.ytimg.com/vi/vjoYesVE3Xs/mqdefault.jpg)






