Andrew Ho

Dispatch an async task in iOS

This will probably be the most simpel async code snippet you will find (use it wisely 😉 ):
[cc lang=”objc” escaped=”true” width=”90%” theme=”default” line_numbers=”on”]
dispatch_async(dispatch_get_main_queue(), ^{
SwitchOutlet.on = YES;
});

Installing a custom font iOS, Xcode

1. Drag your font into the project and include targets
2. Add the font(s) to your info.plist as shown on the following screenshot
Schermafbeelding 2014-12-08 om 21.27.12
3. Use the font! If you don’t know the display name of the font you can use the following code snippet to output all fonts:

 

Core data the basic snippets

Let’s start
[cc lang=”objc” escaped=”true” width=”90%” theme=”default” line_numbers=”on”]
#import <CoreData/CoreData.h>

READ MORE

The best Slide in menu for iOS IMO

I think SWRevealViewController is by far the best slide in menu controller for iOS. The project has been ported to Xamarim aswell. The controller is versatile, stable and powerful enough to support most of your demand. The slide in menu has been booming for some time now although I think menu’s like this have had their time. I personally prefer a tab bar with a ‘more’ option like the Facebook app.

Getting a time based greeting in PHP

Sometimes, all you need is a small function
[cc lang=”php” escaped=”true” width=”90%” theme=”default” line_numbers=”on”]
function getGreeting(){
date_default_timezone_set(‘Europe/Amsterdam’);
// 24-hour format of an hour without leading zeros
$Hour = date(‘G’);
if ( $Hour >= 5 && $Hour <= 11 ) { return "Good Morning"; } else if ( $Hour >= 12 && $Hour <= 18 ) { return "Good Afternoon"; } else if ( $Hour >= 19 || $Hours <= 4 ) { return "Good Evening"; } }

Handling a remote XML in PHP

In this example the status of every object will be printed to the screen.

[cc lang=”php” escaped=”true” width=”90%” theme=”default” line_numbers=”on”]
$url = “https://example.com/yourxml.xml”;
$xml = simplexml_load_file($url);
foreach($xml->Object as $XMLOBject)
{
$status =(string) $XMLOBject->Status;
echo $status.’
‘;
}

Updating data when push message is recieved in iOS

Setting up the NSNotification in the Appdelagate.m

 

Nice menu

An example of a nice menu element in an app.

I wonder how menu items will suite this dropdown menu the best.

Going English

Yes my website is a mix of Dutch and English (I call it Dutlish)

Starting today I am changing my primary language to English. LETS GO!