Thursday, January 2, 2014

Shortcut to "kill" the iOS Simulator

Sometimes Xcode just can't make the iOS Simulator fully quit. Opening a terminal and typing commands to kill the iOS Simulator can take time to get used to. This is why I associated a shortcut key for killing the simulator using a bash script.

Here's a quick guide for creating achieving this:

1. Install Better Touch Tool (you can download it here: http://www.boastr.net)
2. Open preferences window
3. Follow the steps on the picture and paste this piece of code:
killall -s "iPhone Simulator" &> /dev/null
if [ $? -eq 0 ]; then
    killall -m -KILL "iPhone Simulator"
fi


4. Press the selected keyboard shortcut and watch the iOS Simulator disappear.



Thursday, February 14, 2013

UIWebView - Debugging layers - rendering

iOS 6 brings a new debugging feature.

For displaying layers used for rendering a UIWebView's content, set the WebKitShowDebugBorders to YES and restart the application.


[[NSUserDefaults standardDefaults] setBool: YES forKey:@"WebKitShowDebugBorders"];

The layers will be drawn with a border with one of the colors below:
Container
Clipped
Backing Store
Tiled

Friday, December 21, 2012

Redeem code Mountain Lion for developers

Today I found a cool thing that Apple does for registered Mac developers - free redeem codes are available for installing the Mac Os (Lion / Mountain Lion). 
Big surprise for me, wasn't expecting that -  also saved me 20 bucks  :) 

Wednesday, December 5, 2012

iPhone XIB not receiving events in iPad environment

iPhone XIB not receiving events in iPad environment?

When running an iPhone app on an iPad 2/iPad 3 I realized the touch events are not received by the active view controller. After a lot of searching found the solution: start the app in full screen when ran on iPad (this can be set directly in the plist: Status Bar Initially Hidden - true)

Friday, November 9, 2012

Apple programmers' sense of humor

How about this exception message :)) 

-[__NSCFCalendar components:fromDate:]: date cannot be nil
I mean really, what do you think that operation is supposed to mean with a nil date?
An exception has been avoided for now.

Sunday, October 14, 2012

iOS6 - shouldAutorotateToInterfaceOrientation not called

Haven't written on the blog for a while now - here's a good reason for doing that: when launching an older app (that was build on iOS4) in the new iOS 6 simulator, I discovered that the shouldAutorotateToInterfaceOrientation is not called.

After a little digging, I found out that this is the new behavior for new iOS 6 that is NOT backward compatible... WTF Apple, really?...

So, If you see old apps that act funny on the new iPhones, you should know that developers have nothing to do with that...

Here's how this can be "fixed" - for landscape in this particular case:

1. Make sure that you set a root view controller that contains/is your displayed view controller.

    [self.window setRootViewController:nav];

2. Add the new methods in the displayed view controller

// this is for iOS < 6
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation
{
    // Return YES for supported orientations
    return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}

//this is for iOS >= 6
//crappy iOS6 fix,'cause the should Autorotate to interface orientation doesnt get called
- (BOOL) shouldAutorotate
{
    return YES;
//    UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation];
//    return [self shouldAutorotateToInterfaceOrientation:orientation];
}
- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscape;  
    
}

Thursday, August 2, 2012

iPhone 4S or iPad?

Before the iPad, every morning I used to power on the PC/laptop to check my emails and news.
Before the iPhone 4s, every morning I used to check my emails on the iPad
After the iPhone 4s release, it seems I am using the iPad on special occasions...
So...