PHP APNS: Apple Push Notification Service

<?php $deviceToken = ‘token’; // masked for security reason print “token $deviceToken “; // Passphrase for the private key (ck.pem file) // $pass = ‘password’; // Get the parameters from http get or from command line $message = $_GET['message'] or $message = $argv[1] or $message = ‘Message received from javacom’; $badge = (int)$_GET['badge'] or [...]

Changing text on Cancel Button in UISearchBar

iPhone: a little work

เอาไว้ scroll uitableview ไปข้างบน

[tableview scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:YES];

เวลา scroll แล้วช้า ก็อาจจะลองทำแบบนี้ โดยการใช้ UIScrollViewDelegate เมื่อเรา Scroll ลงไป แล้วหยุด ก็ให้ไปโหลดรูปมาใหม่

#pragma mark – #pragma mark Deferred image loading (UIScrollViewDelegate) // Load images for all onscreen rows when scrolling is finished – (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate { if(!decelerate) { NSLog(@”scrollViewDidEndDragging “); [self loadImagesForOnscreenRows]; } } [...]

Objective C: Callback Function

พอดีว่าจะต้องเขียนโปรแกรมแสดงชาร์ตเพลงของคลื่น VirginHitz ก็เลยกะว่าจะดีไซน์ส่วนของการไปดึงข้อมูลออกมาเป็น Service หนึ่ง แล้วก็ให้ Main Program ไปเรียกใช้ แล้วต้องการให้เมื่อ Service ดึงข้อมูลเสร็จ ก็กลับมาบอก Main Program ว่าทำงานเสร็จแล้ว เพื่อให้ Main Program ทำงานต่อไป

จริงๆแล้วเพื่ิอนำไปใช้สั่งให้ Spinner ทำงาน (สำหรับ cocoa เรียก Activity Indicator) แต่ไม่รู้ว่าอันที่จริงของ cocoa design pattern เค้าทำยังไง แต่เนื่องจากเขียน Flex มาเยอะก็เลยขอยืมแนวคิดของ Flex มาเลยละกัน
Continue reading “Objective C: Callback Function” »

Objective-C: Program Looping

The for statement
The while statement
The do-while statement

Continue reading “Objective-C: Program Looping” »