Stanford CS193p Developing Applications for iPhone 4, iPod Touch, & iPad Fall 2010 Stanford CS193p

Stanford CS193p Developing Applications for iPhone 4, iPod Touch, & iPad Fall 2010 Stanford CS193p Fall 2010 Today Blocks Language syntax for declaring a function “on the fly.” Grand Central Dispatch C API for leveraging blocks to make writing multithreaded code much easier. Stanford CS193p Fall 2010 Blocks What is a block? A block of code (. a sequence of statements inside {}). Usually included “in-line” with the calling of method that is going to use the block of code. Very smart about local variables, referenced objects, etc. What does it look like? Here’s an example of calling a method that takes a block as an argument. [aDictionary enumerateKeysAndObjectsUsingBlock:^(id key, id value, BOOL *stop). | Stanford CS193p Developing Applications for iPhone 4 iPod Touch iPad Fall 2010 m MAGAZINE REVIEWS a m ALBUMS rworos BtVMWS MAGAZINE Ft1 r . 9 41 ĨVE SUBSCRIBE MUST READ Music For Life I Sf SPIN S 25 Must-See Summer Tours From Paramore to MGMT pictured to Kings of Leon we pick the season s best. MORE Paramore Party EXCLUSIVE Paramore traverw th oounnry on 25 Summej That Matte Get the scoop 0 releases by M l. Robyn and mor YouTube iPod 12 56 PM E3 Maps .III AT T Text Clock 9 42 AM Calendar Stocks Calculator Photos Maps Notes 1 iTunes Stanford CS193p Fall 2o1o Today V Blocks Language syntax for declaring a function on the fly. V Grand Central Dispatch C API for leveraging blocks to make writing multithreaded code much easier. Stanford CS193p Fall 20I0 Blocks V What is a block A block of code . a sequence of statements inside . Usually included in-line with the calling of method that is going to use the block of code. Very smart about local variables referenced objects etc. . What does it look like Here s an example of calling a method that takes a block as an argument. aDictionary enumerateKeysAndObjectsUsingBlock id key id value BOOL stop NSLog @ value for key @ is @ key value if @ ENOUGH isEqualToString key stop YES This NSLog s every key and value in aDictionary but stops if the key is ENOUGH . . Blocks start with the magical character caret Then it has optional arguments in parentheses then then code then . Stanford CS193p Fall .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.