Tag: Cocoa

A Comment on Remote View Controllers in iOS 6

Ole Begemann has written an blog on Remote View Controllers in iOS 6, which shows Apple has adopted XPC in the sharing service of iOS 6.

As the XPC in iOS is still a private feature, we still have no idea about what will come together with the next major release. At he end of the blog, Ole put some outlooks regarding on XPC in iOS.

Remote view controllers are an exciting new feature for iOS. I sincerely hope that Apple will use this technology in iOS 7 to enhance data sharing and communication between third-party apps without compromising the iOS security model. We need it.

How could this work? Apple could ask developers who want to provide a sharing UI to other apps to include a second executable in their app bundle. This executable would be an XPC service that looks a lot like the MailCompositionService.app we analyzed above. Its main component would be a stand-alone view controller that was able to communicate via XPC and implemented some standard Apple-defined protocols named something like UISharingRemoteHost and UISharingRemoteService.

Apple’s existing UIActivityViewController would then maintain a list of registered sharing services and present these options to the user.

I hope we will see something like this next year.

With the 5-year evolution, iOS has been so powerful than ever before, unfortunately, it still doesn’t support inter-app communication. I think most developer would be very happy to see this being available in iOS.

As my consideration, I agree that the implementation described above is feasible, however, I doubt whether Apple will do this or not.

  1. Technically, XPC is introduced to OS X to help developers break a large App into several building blocks based on their functions. In OS X, the XPC services are privately bundled in their host App. Which means those services are not system-wide (A system-wide service module is something like Microsoft’s COM+), and there is still no way to invoke these services across different Apps.

    Although the XPC services are clearly different to the services on OS X, I believe that Apple will make a few XPC services be able to be invoked by other Apps (probably by wrapping those services into a common framework), but they would not allow any 3rd-party provider to create their own system-wide XPC services. Because it will be very difficult to handle the consistency of the services, especially on a mobile device. What if a service is not upgraded to the latest version? What if there are multiple dependency to different versions of a certain service? It will bring mess as well as benefit.
  2. As to the business strategy, Apple is always choosing the partner with great care. Those services which has integrated into the iOS not only benefit the users but also the service provider and of course Apple as well. So, what will make Apple allow any 3rd-party provider to provide system-wide services? I’ve no idea yet.

Anyway, let’s see what we will have in iOS 7.

用Key-Value Observing解耦视图控制器

Implementation with KVO

Follow 在Objective-C中,有一种称为Key-Value Coding(KVC)的机制。简单地讲,就是一组为对象属性命名的规则。符合这个规则的对象,可以使用runtime提供的-valueForKeyPath:和-setValueForKeyPath:方法进行访问。类似Java中的Ja...

Read More.

关于Core Animation工具箱的构想



这个构思的起因是2011年底前的一个iOS项目。设计MM为了吸引用户,在UI中设计了各种可爱的元素。也差不多在这同时,Path 2登场了。其精致的动画让设计MM意识到动画也是体现UI表现力的重要手段。于是,她就开始设计中增加动画元素。


  • UI设计师如何描述动画
  • 开发人员如何实现动画
    在Mac/iOS平台上,实现动画主要靠的是Core Animation框架。然而Core Animation比较底层,因此Apple对其进行了封装,提供了Cocoa Animation以方便开发人员实现动画。但不论在Mac还是iOS上,通过编程方式实现动画效果依然需要大量的代码,而且对于比较复杂的动画,开发人员还是需要直接通过Core Animation操纵CALayer、CAAnimation来实现。在我的项目中,最重的view controller里,居然有80%的代码用于实现动画效果。


Does real animator write codes? Definitely NOT!


如果存在这样的工具,不仅能有效简化设计师和程序员之间的沟通过程,实现工作职责的更合理分配。更重要的是,它还能使代码变得干净,提升代码和动画的可复用性。 Read More.