On Dec 21, 2010, at 7:04 AM, Kenneth Baxter wrote:

> Hi, I have an application which I plan to roll out on both iOS and MacOS X, 
> and it needs to display text in various places on a series of views. I am 
> doing all the drawing using the Core technologies (CGContext drawing) to make 
> the maximum reuse of code. I've done most of the graphical stuff and am just 
> moving on to the text.

You should probably re-evaluate your approach.  While it may be absolutely 
necessary in your case to step down to a low level, you may find it better to 
use higher-level platform-specific code.

For my main application, the only code that is truly shared are model objects 
and to some extent, certain types of "support" controllers.  All view code and 
the majority of controller code is completely different.  And, for iOS, it's 
often the case where controllers and/or views are further different between 
iPad vs. iPhone/iPod touch.

Another huge difference in my app is that the Mac OS X code leverages massive 
amounts of bindings.  That simply doesn't exist in iOS.  Thankfully, the 
relevant bindings code in my models (e.g. keyPathsForValuesAffectingFoo) are  
easily ifdef'd out when compiling on iOS.

> Sometimes the user needs to edit the text, so I am planning to add a subview 
> (NSTextView / UITextView) while they are editing, but I need to be sure that 
> it's going to be exactly the same rendering size, position, wrapping etc. 
> between the text views and the core drawing.
> 
> Is there anything special I need to look out for to ensure that it's the 
> same? Is this the best way for me to achieve my goal of maximum reuse and 
> seamless switching between the drawn text and the text view for editing?


I'm not sure what you mean by "it's the same".  Do you mean pixel for pixel 
accuracy between Mac OS X and iOS?  I don't thing that may be possible (at 
least at a high level) as there may be different rendering techniques.  Default 
fonts between the systems are different and perhaps there's also subtle 
anti-aliasing differences, etc. Also, iPhone 4 introduced the Retina display, 
so output on such screens will provide much higher-quality output.

Behaviors in the UI between both systems are also very different, so attempting 
to share code to manage behaviors will prove to be problematic.
___________________________________________________________
Ricky A. Sharp         mailto:rsh...@instantinteractive.com
Instant Interactive(tm)   http://www.instantinteractive.com



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to