iKy1e | iOS Developer

Recreating iOS6’s remote views for iOS 5

If you haven’t already read @olebegemann’s blog post about _UIRemoteView’s and remote view controllers new in iOS 6 then please do so now and come back to this after you have finished it.

http://oleb.net/blog/2012/10/remote-view-controllers-in-ios-6/

 

When I first read this post about iOS 6 and _UIRemoteView’s which allowed apple to move things like email into different processes and still display them as if they where in the app there was one point I that caught my attention more then it would most peoples.

<_UIRemoteView: 0x1e05c300; frame = (0 0; 320 480); transform = [0.5, -0, 0, 0.5, -0, 0]; userInteractionEnabled = NO; layer = <CALayerHost: 0x1e05c460>>

CALayerHost, the instant I sure that I thought, “wow, Apple finally put it to good use’. From my experiments with CardSwitcher I have come across CALayerHost’s before. They are actually how CardSwitcher’s live views work. More then displaying part of an app, however, they also allow interaction through to that app (although that is buggy iOS 5, haven’t tested 6 yet). For CardSwitcher to use them as live views into apps it actually has to block interaction, if you remove that you get this http://www.youtube.com/watch?v=1D1NyXITjI0.

Keep reading


Check

If you are a heavy email user you will likely have noticed in iOS’s default mail app you have to select each and every email separately, so if you want to select lots, say 30 emails, you have to scroll through the list selecting each and every one. Check allows you to just tap and hold on an email and then scroll as far as you like before tapping another. Everything between those 2 emails will be selected (or deselected) automatically.

The idea was originally Joshua Tucker’s and he planned out the details, like the flashing animation to show which is the start point, and then I worked out how to implement them. 

http://www.idownloadblog.com/2012/07/09/check/

http://www.addictivetips.com/ios/check-batch-select-multiple-items-in-ios-mail-with-a-single-touch/


MountainCenter

I recently released a joint project with Jonas Gessner called MountainCenter, it was inspired by MountainLion’s implementation of NotificationCenter which has the notification center appear from under the right hand side of the screen.

It also has a smooth dragging gesture from the edge of the screen to drag it over and reveal the notification center underneath.

http://www.idownloadblog.com/2012/06/23/mountain-center-cydia/

http://modmyi.com/content/8045-mountaincenter-makes-notification-center-ios-react-like-os-x-mountain-lion.html


Current Projects: Understanding iOS’ App Rendering

For the last 2 months almost all my work has been on reversing how iOS displays apps on screen. There are a few ways to get the display information and pass touch events down to the application. Currently I’d like to think I understand about 80-90% of how SpringBoard manages and displays apps.
For instance, when the App Switcher launches it doesn’t move the applications window ‘up’ as it looks like visually but rather displays a view that is rendering the applications SBContext’s instead of it. That is then moved up so the application itself is not involved (why if you check the window’s frame of an application it doesn’t change with the app switcher’s opening and closing.

Keep reading


Code Snippet: Launch apps on iOS5

I’ve been working with the SBDisplayStack’s lately and trying to control how apps launch and finally got it working, much more simply then a was trying originally.

The finished code has been put together into an opensource library on GitHub called LibDisplay.

One odd thing that caught me out, for ages, is you have to start launching the next app before getting rid of the current one.

/* References:
 * http://iky1e.tumblr.com/post/13985531616/raw-log-sbdisplay-settings
 * http://iphonedevwiki.net/index.php/SBDisplay
 * http://iphonedevwiki.net/index.php/SBDisplayStack
 * http://code.google.com/p/iphone-tweaks/wiki/DevelopmentNotes
 */



-(void)activateApplication:(SBApplication *)toApp animated:(BOOL)animated{
    // Get the currently open application.
    SBApplication *fromApp = [self topApplication];

    // Check if it's the same as the currently open application, if it is there's nothing todo.
	if ([[toApp displayIdentifier] isEqualToString:[fromApp displayIdentifier]])
        return;

    // If animated they want the system default (app to app transition, or zoom on homescreen).
    if (animated && toApp) {
        [(SBUIController*)[objc_getClass("SBUIController") sharedInstance] activateApplicationFromSwitcher:toApp];
        return; // Done, wasn't that easy.
    }

    // Now, if we were asked to, open the other app.
    if (toApp) {
        [toApp clearDisplaySettings];
        [toApp clearActivationSettings];
        [toApp clearDeactivationSettings];

        // 20 = appToApp
        [toApp setActivationSetting:20 flag:YES];

        // Note if it's a large application the user might see a brief flash of the homescreen.
        [[self SBWPreActivateDisplayStack] pushDisplay:toApp];
    }
    

    // If another app is open then close it
    if (fromApp) {
        // Clear any animation settings the app may have
        [fromApp clearDisplaySettings];
        [fromApp clearActivationSettings];
        [fromApp clearDeactivationSettings];

        // Now pop is from the Active displayStack
        [[self SBWActiveDisplayStack] popDisplay:fromApp];
        // And push it onto the Suspending displayStack
        [[self SBWSuspendingDisplayStack] pushDisplay:fromApp];
    }

    if (!toApp) {
        // The user should now be on the homescreen.
        // There's a bug above 4.? (4.1 or 4.2 I think) where the status bar won't be there.

        SBUIController *uiController = (SBUIController*)[objc_getClass("SBUIController") sharedInstance];
        if ([uiController respondsToSelector:@selector(createFakeSpringBoardStatusBar)]) {
            [uiController createFakeSpringBoardStatusBar];
        }
    }
}

A few notes about this:

  • This info is “as of” iOS 5.0.1 and I can only confirm that it works on iOS 5.x.
  • although, Multifl0w pushes the displaystacks around itself and worked without modification (to the best of my knowledge) when iOS 5 was released (so it might not break very often).
  • When closing an app without an animation SpringBoard will still animate the icons unscattered (there’s almost certainly a work around but I haven’t needed to look for it).

12
To Tumblr, Love PixelUnion