Showing posts with label Mac OSX. Show all posts
Showing posts with label Mac OSX. Show all posts

Tuesday, March 3, 2015

Converting file url to and from strings with swift

There times where you need to display a file url as a string. This might be to display a list of files into a Table View or even a field. 

Below is a custom function I made to do this. It takes one parameter a NSURL and returns a string as a absolute file path

func myFileString(theFile: NSURL) -> String {

return theFile.absoluteString

}


And if you need to convert the string as a absolute file path back to a NSURL this custom function does that. It takes one parameter a string as a absolute file path.

func myFileStringURL(tFileString: String) -> NSURL {

return NSURL(fileURLWithPath: tFileString!)

}


As you can see not very hard, but useful. Making custom functions for later reuse of code for future project can be helpful. These work for Swift and Mac OS X with Swift v 1.1

Thanks, and happy coding ;)


Saturday, February 28, 2015

Fun with Swift recap

Since 2015 we added a number of Swift tutorials to this blog for Mac OS X and iOS. I mostly have focused on Mac because I discovered there not many code examples around the web for Mac and swift. iOS there thousands of them and many are very good.

I also have been making apps for the Mac since 1997 and would like to see so many more jump on board to the Mac OS platform. Users are actually willing to pay money for a Mac apps, unlike iOS where anything over $0.99 is frowned upon.

I going to recap  back to all of the 2015 post we made so far up to March 1st on Swift.

Saturday, January 17, 2015

Using Swift for Mac OS X apps


The basic intro of using strings.

view topic

Tuesday, January 20, 2015

Hello Mac From Swift


A video walk through of Xcode and how to make outlets and actions. How to setup UI Controls, Windows with layout constrains. How to use and combine text strings.

view topic

Friday, January 23, 2015

Make OS X Web Browser with Swift


A video showing how to make a basic web browser with swift, inculding adding Google search.

view topic

 Saturday, January 24, 2015

 Sliders with Swift


A basic look at how to uses the a slider control.

view topic

Tuesday, January 27, 2015

Alert Messages with Swift


A look at how to present a NSAlert

view topic

Saturday, February 14, 2015

Alerts with Swift for iOS


A look at how to use alerts with iOS.

view topic

Wednesday, February 18, 2015

64-bit requirement for iOS


Simple info about all app store apps require 64-bit support.

view topic

Wednesday, February 18, 2015

Tabbar for iOS with Swift


A video to show how to add more tabs to a iOS tab view app.

view topic

Friday, February 20, 2015

Swift language update


Info about Apple beta release of Swift version 1.2

view topic

Saturday, February 21, 2015

Xcode swift tip: Access to docs fast


A tip on how to access header files fast in Xcode to quickly speed up development.

view topic

Monday, February 23, 2015

Swift for Mac Cocoa: Radio Buttons


A video show how to program with Radio Buttons and NSMatrix with Swift.

view topic

Wednesday, February 25, 2015

Swift for Mac: Programming Image Views


Another video showing how to load bundle images and present them on screen.

view topic

Thursday, February 26, 2015

Swift for cocoa importing files with open panel


Another video showing how to use a open panel to import and read files selected by the user.

view topic 

See All Swift Posts

View



I will be adding more swift examples this year, however I will also be focusing back on cross platform also.

Thanks and happy coding ;)

Wednesday, February 25, 2015

Swift for Mac: Programming Image Views

Today's Swift example shows how to display images “photos” in a cocoa based app. It is actually easier with Swift and Xcode, than with most third party development tools I used.

Video to watch is here:



Thanks, happy coding ;)

Monday, February 23, 2015

Swift for Mac Cocoa: Radio Buttons

When it comes to Swift for Mac OS X cocoa there very little info to be found anywhere. Google very rarely returns anything useful. The only swift examples found for the most part are for iOS not Mac. The two platforms are not really the same even if they use the same programming languages

Personally I want to use Swift for everything, because I really like it. It is possible to inter-mix Swift and Objective-C but why? Apple set up Swift to work completely on its own two feet.

Today is a basic example on how to use AppKits Radio Buttons for a Mac cocoa base app. I go over how to get which radio the user clicked on and how to set a highlighted radio cell by swift code.

I have a video showing you this in full, Here a my video on YouTube:



Thanks, happy coding ;)



Friday, February 20, 2015

Swift language update

Apple recently announced the Swift  language will soon be entering version 1.2 and with that it will bring several notable changes.

All of the examples I shown part of this blog up to now use Swift v 1.1,  Note I will continued to show Swift version 1.1 until Apple officially releases this new Swift version as GM public release. I am not able to show pre-released , based on my license with Apple.

Currently Swift Version 1.2 is in beta and can be used with Xcode beta 6.3. (this if you have an active Mac and or iOS developer license). You can learn more about it at Apple Swift Blog. Also note there said to be a migration tool that will be able to convert your swift version 1.1 code bases to version 1.2, which should be a major plus.

If your interested in swift I highly suggest you follow Apple swift blog for the new language changes and tips. Swift Blog Here You also can follow the blog va Twitter @SwiftLang



Tuesday, January 27, 2015

Alert Messages with Swift

Here is a quick look at using a modal alert window with swift for Mac OS X



The main window has a simple button action to present a basic modal alert with a text string.

the code to do this in swift is:

@IBAction func btnShowAlert(sender: AnyObject)
        {
            var myAlert:NSAlert = NSAlert()
            myAlert.messageText = "Alert Text Here."
            myAlert.runModal()

    }


Alerts can be more in depth than this. This was just the basics to show how easy they are to add and use in swift. Alerts can also sheet from the main window by using;

beginSheetModalForWindow()

Instead of using the runModal()


Happy Coding;)

Saturday, January 24, 2015

Sliders with Swift

Here a quick one how to display a value of a NSSlider with swift in a field.Here the running example:


To basically only get the value from the slider we only need to make an outlet for the text field and an action for the slider. ( However if you want to set the slider by code you also need to make it an outlet also.)

The Slider action is as follows:

// field Outlet
@IBOutlet weak var fldSliderValue: NSTextField!

// NSSlider Action
@IBAction func mySlider1(sender: AnyObject) {

// x holds the value as a double as the slider changes position
var x: Double = sender.doubleValue

// to get the value to display as text string in the field do this
var mystring = x.description

// display the value in the field
fldSliderValue.stringValue = mystring

 }

Below is the source view:


Swift for Mac OS X is really fun. Will be sharing more soon.  

Friday, January 23, 2015

Make OS X Web Browser with Swift

Make OS X Web Browser with Swift



The last swift example we did was using basic text strings. This next example takes what we learned using basic text string and shows how they can be used to make a very basic web browser. By taking basically the user inputed text we will load a web page. Also we will take a basic user field input and take that string and do a basic google web search. The video still stays in the realm of basic, however you can see how quickly the project could and should start using functions and be broken into separate sources files.




Swift for Mac OS X is really not very hard to pick up and makes in a good choice for those who came from Apple Script, Basic, Ruby, Javascript or a Small Talk language to pick up quickly as it is very similar to what you already know.

Swift makes you start  to see very fast why you should consider using it over a 3rd party tool, as it simple to learn and use. Best of all it has access to everything Mac or iOS and is free to use. (note for iOS the webview is done differently. It is kind of the same, however you need to use UIWebview instead. It is also more limited than the webview for Mac in what it can do.)

This video a little long at 30 minutes but covers a bunch. Will likely revisit this project in the future with more advance topics.

Here the video:

(It supports up to 1080p and may even work with the new 1440p Beta resolution.
It may take a while for youTube to Process higher video resolutions upto a hour from posting, I suggest 1080p or higher to read the sourcecode.)

And if you on a mobile device and want to view on the you-Tube app instead here the video link (video quality is better for mobile on youTube app) http://youtu.be/khhi52p9szQ




Thanks and happy coding ;)



Saturday, January 17, 2015

Using Swift for Mac OS X apps

Yesterday I ran into an issue out of my control with a 3rd party cross platform tool I use. The issue was something that may end my development with it for Mac OS X. Now I not 100% sure if I will not find a work around with that tool. However it is very clear that I need to stop putting all my eggs into one basket and make a real move into using Apple's Xcode to build for Mac OS X in the future.

I already been learning swift for iOS, however when it comes to Mac OSX there very little info or example projects floating around. Even Apple developer site has only 3 swift examples for Mac OSX but have a ton for iOS. Mac and iOS are not the same.

I decided I going to do, if my schedule allows it one or more Mac swift project a day for the next 2 months and really learn how this is done. I have already meet a dozen other developers who want to learn swift for Mac also and are trying to find examples to.

That why I going to share much of what I learn each learning project I do here as, it may help some what.

I decided to skip the Hello world app and start with working with basic text strings and very basic button actions for my first mac demo.

Now first off for a Mac swift project there only one source file the AppDelegate.swift file that all your code goes in.

You still design the interface in Interface builder much like it was done with objective c. Just like with Objective-c each object needs to be assigned an outlet or a action however this is done in the same  AppDelegate.swift file.


This example will simply take the text from each 3 fields and add it together with the process button. And secondly with the clear button remove the text from all 4 fields.

The photo below shows the outlets for all 4 text fields. to create the outlet, first put Xcode into 2 views. the left one the interface view the right one the source code view for AppDelegate.swift. (If that file does not appear in the right side of the subview. At top left corner has 4 boxes like icon, click there to get a sub menu to switch the source code for the view.) To create the outlet simple select a field while holding down the control button and drag the string like graphic to the source code view as like the photo below. This will present you with a pop over window where you name the field (such as fldFieldName) that in turn makes an outlet. do this for each field. (below is an image of the added outlets, Note the window outlet was pre made by Xcode as was the functions for app launching and will terminate) 


Next Adding actions to the buttons. This is done similar to how you create a outlet however you need to add this code after the last function Xcode made but between the last "}" symbol. Also note when the pop over appear there a pop up menu if you select that, you can change the outlet to action. That what you want to do for the button, then assign it a name and hit return.

for my mini app I have the following:
 @IBAction func btnProcessName(sender: AnyObject) {
}

Now between the {} you add your code. Working with strings in Xcode is pretty simple and is similar to many other development languages. we take the object dot property such as:

@IBAction func btnProcessName(sender: AnyObject) {
        fldFullname.stringValue
    }

To assign as value to this fields string value (text) use the = symbol and basically just add the text together. This example does not current check if a field has no text however doing such would not be hard. 

The final action that makes a full name from 3 text fields for first, middle and last name looks like this:

 @IBAction func btnProcessName(sender: AnyObject) {
        fldFullname.stringValue = fldFirstName.stringValue + " " + fldMidName.stringValue + " " + fldLastName.stringValue   
    }
And last to clear all text from the text field as simple action very similar to many programming languages. 

 @IBAction func btnClearAllText(sender: AnyObject) {
        fldFirstName.stringValue = ""
        fldMidName.stringValue = ""
        fldLastName.stringValue = ""
        fldFullname.stringValue = ""
    }
And below are additional images of this very simple swift learning example for Mac OSX.

The full source code (and yes you can make your Xcode editor any color, like mine.)

And last an screen shot of the app test running (like my input;) )


I know I did not do a video, but my upstair neighbors are very loud with there yelling and screaming that a video would not work today. If you think a video would help I could do one in the future when they calm down upstairs.

I hope this helps some as it help me making it to learn myself.

Happy coding ;) thanks for visiting.

Sunday, October 26, 2014

Xojo on Mac OSX Yosemite.

This is a basic preview of the basic gui from Xojo on Mac OSX Yosemite, for those not on this OSX version yet. I have not notice any issue with any control that comes built in with Xojo (xojo 2014 r2 or higher) Also all MBS controls also work without issue. 

The full screen button is now the green button. Also the toolbar tabbed button looks more like linux now. Actual the whole interface looks linux like.

The only known issues are the Social Sharing and Notifactions (plugins or declares) no longer work in OSX 10.10. However this is not a Xojo only issue, its a 32-bit vs 64 bit built application issue. As these two frameworks are now 64 bit only changed by Apple without warning. They now require a 64 bit build for OSX app to work. 

Xojo has anccounced that in 2015 that they will be adressing 64 bit on all platforms. Starting with iOS and Linux, followed by OSX and Windows. 

Monday, October 20, 2014

An apps perceived value, Choosing the right tools.

With the update to Mac OSX 10.10 Yosemite, Xojo Native UI is updated without doing one thing or updating apps based upon appearance. However with Livecode the UI is a mess on this new OS version. If your forced into using custom controls to get a mac like appearance, like many Livecode developers do. Then there forced into updating apps with a new custom UI or worst just using the old non updated user experience (witch can be the case, because the app could have been made on a Windows or Linux machine. And that developer does not know any better because that.)

This all boils down to customers perceived value. If the customer sees a UI that old out of date and broken the perceived value of the finish product is not great and it equals lost sales. A customer will decide in a split second based on the appearance of your product if its worth there time. If you lose them in that second because of appearance and user experience, then you have a very hard sell in front of you.

In todays app market there several apps that do similar things. While one app could actual be better in functionality if it looks bad and has no pride of ownership it will fail vs an similar product that deliveries the perceived value the customer is looking for. 

When I personally used Livecode for Mac OS, iOS and Windows software 80% of the year was spent updating apps to work with a new OS release, 75% of that was based of user experience. (because Livecode does not use native UI and your forced into building a custom UI to just make a app look better than out of the box.) Now using Xojo and Swift the time I spend updating apps on appearance is zero. That means I have 100% of my time to focus on new products or adding new features to existing products. 

Example:

One application that I made since 2003 is called File Mutation Pro (from 2003 - 2012) This Application was made with Livecode. Since 2013 Its been remade with Xojo. 

Since moving to xojo with this product I was able to add many native platform user experiences and Native API's including adding AVFoundation, AudioToolbox, CoreAudio, CoreVideo, CoreGraphics, NSText etc etc. Things that can be done with Livecode using C++ but not as easy as with Xojo and not as robust. 

Since moving over to Xojo the product also has seen better overall success. The overall sales boomed since switching to Xojo from Livecode. Many of the long time customers that used both the Livecode built version and the Xojo built version actual wrote us, thanking us for the great improves that the Xojo version gave. Many thought the app (built with Xojo) was worth more money, even if it did the same things (as the versions built with Livecode).


The First Picture Below Is the last Livecode built version of my app File Mutation Pro. It using a full custom UI because the Livecode UI did not look like a mac app made in the last decade.


The Second Picture or the one below Is the Version of File Mutation made with Xojo. I can see why customers prefer it on looks and user experience alone.


One really needs to consider the end product these cross platform tools make. Livecode maybe fast to code with. However if your spending ever year updating a product X% of the time because of a new OS update its not really saving time or money like Xojo does in the end.

Xojo is not prefect either, but its 100 times better to actual gaining the perceived value and increasing sales. I still a fan of Livecode and I like to see them improve there tools. The thing is Xojo does most of this stuff now and can turn you and your products into a star now. 

I talked to some developers the other day that seem to not care what the app looked like, I believe that is a mistake on there part. Would you want a rust bucket car or a brand new car, if both cost the same price and did the same thing? There a reason why there thousands of rust bucket cars sitting in junk yards all over the world.

Even if your not a fan of Xojo, perceived value is a important thing to embrace. It will allow you to gain more value for your products in the end. Specially in a marketplace that has competitors to your products. If you take pride in your products appearance and user experience then your customers will open there wallets.

Friday, October 3, 2014

From Livecode to Xojo buttons and such

Another look at moving from Livecode to Xojo ( two different cross platform development tools) or the other way around. This time around we look at a very basic UI elements, buttons and tab panels. One tool looks like a million bucks while the other just looks not so good.


Below image is the default button set and tab panel styles of Livecode 7.0 (with cocoa support on mac)

Below image is the default button set and tab panel styles of Xojo 2014v2 (with cocoa support on mac)


The two photos clearly show one set of controls that looks like a million bucks and another one that looks not so good. Why is this important? If you have a product aka app that does something awesome but looks bad with buggy UI no one going to want to buy it. Looks are important to so many people who are willing to pay money for something. Second one of the photo shows old outdated and even buggy controls. That will bring into question your actual app and how sound it is and if It actual works. One set of UI shows pride in ownership the other does not.

But to give it a chance beyond just photos I did a video of both Livecode and Xojo and look at the UI elements of buttons and tab panels. It may help a little choose between the two tools for your next project.



enjoy.




Tuesday, September 23, 2014

Preview files with using Quick Look

One of the coolest thing I like about using Xojo is we can add functionality easily to a app deployed to a certain system. Such as adding a view to preview any file on Mac OSX with quick look within a window. This added functionality can be added using declares, macOSLib or Plugins.(Monkey bread complete plugin as one example of a plugin.)

I spent over a decade using a tool called Livecode that had no real way to add any additional functionality within views of a window. This made for very non professional looking apps that had outdated user experience and needs hacks to do anything cool. The problem with hacks, is they are not a safe way to make a app. A poor user experience also leads to less sales. 

With Xojo this is possible and without any special hack. This is one of the main reasons why I use Xojo over the now outdated Livecode that still stuck back in 2005 for most of what it does out of the box.

I will walk over how to add a quick look view within a window and also add a panel view in this video tutorial. Additional bonus items that also can be used on any platform includes; adding and removing a file list to and from a list box. And how to use classes to assign supers.




enjoy

Tuesday, August 6, 2013

From Livecode to Xojo Read & Write Text Files


Both Livecode and Xojo are cross platform development tools.

This week in our Livecode to Xojo series... Is how to read and write text files with both development tools. If your new to one or both tools this will show an similar way to do the same thing with both tools.



-

If you find this video helpful please go to you tube and give it an like. Happy Coding :)

Thursday, July 18, 2013

From Livecode to Xojo Switching Views


Both Livecode and Xojo are cross platform development tools. Both have strengths and weakness. However it no shock how much more I prefer Xojo over Livecode for desktop development, as the Xojo makes an far better and more modern final product on Mac and Linux than Livecode does. On Windows both do similarly well.

For mobile Livecode currently supports iOS and Android where Xojo will soon will do iOS, however not Android. Xojo also does the web where Livecode does the server. So again each tool has pluses and minus. 

I have used Livecode for over 8 years professionally and Xojo (and former product names) 6 years.
I also get many clients asking to convert Livecode code bases to Xojo and also Xojo code bases to Livecode so I figure I could do an few videos showing the different ways using both tools, to get one started using either or of the tools.

First in this new series is switching views. I will keep every video under 15 minutes long, even if that means editing the content down.

There many of way to switch views than what I present, but I walk over the basic ways for both tools.




Again Happy coding :)

Tuesday, July 16, 2013

Toolbar Toggles With Xojo


With Xojo (Real Studio) Making an Toolbar behave like an tabbed view controller does not work by default. Even with using the inspector settings. This is an walk over to how to get this to work. This will work perfectly on all platforms Mac, Windows and Linux. It does not need many steps but does require code.




I have added an screen record video (free, cause this info should really be free! ) That shows how to get this to work.



-


Enjoy and Happy coding:)

Sunday, June 9, 2013

Xojo (Real Studio) New IDE out, Here is the lowdown.

Xojo formally known as Real Software whom made Real Studio and once Real Basic, has released there new Cross platform IDE tool Xojo 2013 r1. While there are some minor bugs in this first release, it is an great IDE if its compared with other cross platform tools (such as Livecode).

Since 1996 when I first started making software for money, I have used many such cross platform tools. None really compare to the overall quality of Xojo development tools or the final compiled product.

The IDE is basically one window, however as seen in the screenshot you can palette the object and properties panes (which I personally find make an faster workflow, during gui layout). 


What I really like about Xojo is it designed for the professional developer in mind first. Some of the other tools I have used seem to be designed for hobbyist first which make it fall short. 

Xojo has built in tools that help get the job done faster and with great results. I can not even cover all of them here, because there so many things it does that other tools do not. 

If you spend over 80 hours a week making apps like I do, having the right tools matter.

Having an fully customizable code editor is an major plus. Many other tools just do not get it, when it comes to code editing. They think any old plain text editor will do (which I guess it can work, if you spend little time writing any code.)

I prefer having and working with an editor that one can adjust colors of the syntax and background to anything.  After 14 hours an day, 6 days an week if not 7 staring at black text on an white background it can really kill your eyes. Specially if your already wearing glasses.



Also being able have syntax autocomplete is an major plus. Typing thousands of lines of code one char at an time adds up. This takes longer in time, and adds more chances of creating an bug.

When I compare Xojo to Livecode (another tool I used for 8 years) text editor. Hands down Xojo wins by an land slide. While many Livecode users have requested such changes to Livecode editors for years, nothing ever has come. 

Xojo seems understand how to make tools that make people more productive (While they are not prefect. Compared to other cross platform tools, I feel they understand far better than others.) 

This tool allows for many different project formats which supports source control super easy. Most other cross platform tools do not have this at all.

Built in Unit testing. This is awesome! Easy see bottle neck areas, fast and easy to help optimize your code. Actually no other cross platform tool I used has ever had this feature. This is an major plus, allowing you to deliver an top notch product that works fast.

The best thing I like in the Xojo IDE, is the interface layout and design area. The layout area has measurement guides, advance alignment tools, layering and quick access to every item on an window and also helpful scrollbars, when on smaller displays (macbook air anyone?). 

The best part of Xojo is the end product it makes. It is just better than any other cross platform tool on the market today. It supports many of the most modern platform items and native UI. Also if anything missing that I want access to I can write an declare and add just about any native thing I want. 

Also you can tap into the many resources of other developers and use 3rd party plug-ins that have reasonably prices. Specially when compared to the expensive, and limited 3rd party add-ons of most other cross platform tools

I hear many people complain about Xojo, I really do not understand why. Maybe if you have issues with it, go use Livecode or another cross platform tool for an few years. Then maybe you will see what I am talking about. When you actually compare Xojo to other cross platform development tools, really I see nothing better.

The people who make Xojo deliver promises, they make within an reasonable timeframe. I have been lead on for over 6 years about another tool I used, supporting Cocoa for OS X.Adding Browsers for Linux, etc, etc, etc. It still not done, and may never be done. There to busy working on minor things like syntax changes to things that are not broken.

Xojo offer far better resources to make far better cross platform apps than any other tool I used. It is an great cross platform tool, I highly suggest checking it out. You can use the IDE for free , and it reasonable priced to deploy apps.

Here is an link Xojo website




Wednesday, April 10, 2013

Livecode Cross Platform is now open source

An development tool I used for the past nine years released itself as open source April 9th 2013.
This includes the full source code to the engine for desktop, mobile and server along with the IDE.

Here an quick link to the Git engine source https://github.com/runrev/livecode

The IDE which needs an free account to unlock and use can be found here Runrev

Livecode is an cross-platform tool for Mac OSX , Windows, Linux, Server, Android and iOS.
Its not prefect and can not do everything. However what it can do it does well. For the last 9 years 80% of all the software I have sold was made with Livecode. Even if now I moved on to using Real Studio (Xojo), Xcode and Unity for most of my software and games. (it was not for any other reason than I needed tools that could make professional software that Livecode was no longer suited the best option to build.)

I do recommend checking it out, it will surprise you to find out Livecode can do much more than what you first think it can do.

There also an great amount of 3rd party add-ons and custom controls than any other tool I seen besides Unity. One of the best part of it being open source for me is actually opening up the engine source and tweaking things. However I only started peeking and saying there using that? In I use that already with tool X.

I recall helping out an Livecode user last winter, and when I recommend curl as an option I was told "that dumb I never use it." Well guess what, Livecode was using curl, one look at the source code and licensing shows it.

There are many other interesting discoveries on how they made there tool work. I for years tried to guess what cross compiler they used. When I seen stack-less just in time compiler. I almost fell out of my chair. I had that listed as one of my guesses years ago.

If your new to Livecode, it will depended on coding experience on how you take it. I personally learned programing from BASIC and Livecode is much like hyper-talk. It takes time getting use to if you have years of using other programming languages, because it seems like baby talk. If you can look beyond that you find it works fast and does a lot.

The mobile space is actually very well and 500 times better than Corona sdk. However if you want physics you need to program them your self, which is really not that hard. There is however some major down  sides. The native UI is outdated at best, but you can use custom controls and get them to work pretty fast depending on your skill at design.

For Mac there no cocoa yet, witch means no retina support. This was one of the main reasons I quit using Livecode last year. And moved back to tools like Xcode and real studio.

Personally Livecode still worth an look for Mobile and it also does windows really well. Also Cocoa for mac is now an future project of runrev so its coming. I just do not think it will come till 2014 I could be wrong.

Also the IDE is way dated. And mobile apps windows at 1 to 1 retina sizes do not fit most computer displays. There an few tricks to getting this to work, witch is not all that bad for the trade off in code time saved.

Why not download it and give it an try. Maybe it works for you. Also do not believe everyone on that forum that says you can not do that. I proved many of them wrong for years doing what they said can not be done with Livecode.

Monday, March 4, 2013

Mac Retina Supported Toolbars with Real Studio (Xojo)


Supporting retina base graphics in mac apps is easy. However how would one support retina graphics in an Mac Toolbar. With Retina we know we need to make all graphic files 2 times bigger than the standard resolution image. The standard resolution images files for toolbars are 32x32 pixels so high resolution needs 64x64 pixel images loaded.

Start by using toolbar icons that are 64x64 pixels and label them with an 2x suffix. Then make or use 32x32 pixel toolbar icon images for the standard resolution images. Once you have both an 2x and standard resolution icons for each toolbutton you want to add, import those into your project.

You will also need to build for Cocoa as Carbon based windows do not support high resolution displays at all.

To do this you will need to create the toolbar by code. As of the latest release 2012 r2.1 there no built in way to do this other than by code.


-

Also note that your application will also need to add the following plist setting or it will not work.

<key>NSHighResolutionCapable</key>
<true/>

If your not on an Retina based mac, you can still test your app for retina by downloading Xcode and installing the graphic add-on package. What you need is the Quartz Debugger developer tool application. Using it allows you to test for Retina based resolutions.

The code used in this video can also be used with all other image files within an retina supported app. Such as menu icons, list box icons, segmental icons and the such. Also I have examples of using pdf vector based files with segmental controls where those files alone support retina because they are using vector based images.

All the other system controls and text are fixed by simply adding the property list key:

<key>NSHighResolutionCapable</key>
<true/>

Only Images  bitmap images require the method shown in the video.

Cheers, and happy coding.

Tuesday, February 19, 2013

Retina Based Pattern Fills with Real Studio (Xojo)


Here is an look at how to do pattern fills with Real Studio that supports both standard and high resolution displays. It is really easy.


  -