Archive for the ‘Xcode solutions’ Category

New version of Pie Chart 3D 2.0 has arrived!

July 18th, 2016 No comments

After several months I was finally able to finish new version of Pie Chart 3D application.

In version 2.0 I added all features requested by users:
– you can save images to camera roll – most required feature,
– you can define colors using RGB and HSV,
– chart, labels, title can be moved on the screen with one tap,
– title font face, size and color can be changed,
– colors can be selected from 3 predefined palettes plus one customisable,
– improved handling for decimal numbers.

You can buy also library source code – check details and pricing here:


Pie Chart 3D library Pie Chart iphone library Pie Chart 3D ios xcode library Pie Chart 3D xcode library source code


Pie Chart 3D Creator for iPhone

July 15th, 2016 1 comment

New version was published in July 2016.
Check it out in AppStore. You can buy library source code! Details here:

New version supports all features of version 1.0 and:
– you can save images to camera roll – most required feature,
– you can define colors using RGB and HSV,
– chart, labels, title can be moved on the screen with one tap,
– title font face, size and color can be changed,
– colors can be selected from 3 predefined palettes plus one customisable,
– improved handling for decimal numbers,
– bug fixing.


Description of first version below.
In my previous article I presented my new Pie Chart 3D library. I decided to use it in iPhone/iPad application. You can now enjoy this app and download it form AppStore.

Pie Chart 3D for iPad and iPhone
Pie Chart 3D Creator allows you to create pie chart wherever you are.
Just few taps and your pie chart is ready. You can save it for later or email immediately.

In version 1.0 you can:
– supports iPad and iPhone layout,
– supports rotation,
– add new slices (up to 12),
– move slices on a chart in slice settings,
– change slice size,
– rotate whole chart, just swipe your finger next to chart border,
– skew chart, just swipe up and down in the center,
– scale chart, use two fingers, like with pictures,
– save for later, in chart settings, chart is saved with date and chart name, (up to 15 saved charts),
– load saved charts, you will be warned that your current chart will be replaced,
– delete unneeded charts (just tap edit button on load list or swipe finger to right hand side),
– reset chart values to default 5 slices,
– email image with chart to any recipients email.

Chart uses two nice classes which I created and are available on my website:
– pie chart 3d class for drawing pie charts, with protocol returning clicked slice,
– color picker class allowing quick color selection from the list.

You can enjoy videos or purchase pure library.



Wykres Pie Chart 3D na iPhone – Objective-C – Xcode

July 15th, 2016 3 comments

[English description of Pie Chart Library is available at the bottom.
I use this library in my Pie Chart 3D app – ]

New version of application has been published. There are not too many changes, however you may like better color management, decimal numbers support and a few other changes.

Biblioteki graficzne iPhone nie zawierają zaawansowanych funkcji ani API do rysowania wykresów. Bardzo często w sieci pojawiają się pytania jak narysować wykres kołowy (pie chart).
Znalazłem kilka miejsc, gdzie opisane jest jak narysować płaski wykres wykorzystując linie i łuki. Nie jest to trudne – taką metodę można było już stosować w PHP. Dodatkowo Objective-C oferuje bogate możliwości wypełniania obszarów, pozostaje więc jedynie przypomnieć sobie kilka zasad trygonometrii (sinus i cosinus) i można rysować.

Nie znalazłem natomiast nigdzie rozwiązania do rysowania przestrzennych 3D. W PHP dodano bardzo fajny parametr style=IMG_ARC_PIE do rysowania łuku:
bool imagefilledarc ( resource $image , int $cx , int $cy , int $width , int $height , int $start , int $end , int $color , int $style )

parametr style=IMG_ARC_PIE rysuje fragment wykresu przestrzennego/ slice.

Niestety, w SDK 4.1 mamy możliwość rysowania tylko płaskich wykresów. A więc trzeba to oprogramować samodzielnie.

Postanowiłem przygotować własną bibliotekę, która będzie nie tylko rysowała wykresy płaskie, ale również wykresy 3D.

Poniżej film prezentujący możliwości biblioteki.
Wersja 1.0 wymaga jeszcze kilku poprawek. Planuję również dodanie możliwości wyświetlania etykiet.

Read more…


Pie Chart 3d version 2.0 is coming ….

September 1st, 2013 No comments

After several weeks of hard work, new version of Pie Chart 3d library and new App is coming.

pie chart 3d

New features:

  • you can save images to camera roll,
  • you can define colours using RGB palette (HSV is still handled),
  • chart, labels, title can be moved on the screen with one tap,
  • you can change title font face, size and colour,
  • colours can be selected from 3 predefined palettes plus one customisable, so there are unlimited combinations,
  • improved handling for decimal numbers,
  • you can copy colours between palettes for easier configuration
  • application is available in other languages

All other fancy features like moving, rotating, changing angle, adding, removing slice are still available.
Graph library is now delivered with demo application, which makes integration with your application much easier.

Details soon – stay tuned.




How to sort NSArray of custom objects by multiple properties – case insensitive

April 6th, 2012 No comments

Although sorting in XCode may look as something difficult, there are some quick solutions which allow us to sort array of object in less than 3 lines:

Let’s imagine that we have an array of objects. Each object has two properties: name and code. We want to sort our array by first criteria and then the other one.

We need to define sort descriptors which indicate object property to be sorted by and apply this sortDescriptors to a method sortedArrayUsingDescriptors of our NSMutableArray.

NSSortDescriptor *codeDescriptor = [[[NSSortDescriptor alloc] initWithKey:@"code" ascending:YES selector:@selector(caseInsensitiveCompare:)] autorelease];
NSSortDescriptor *nameDescriptor = [[[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES selector:@selector(caseInsensitiveCompare:)] autorelease];

NSArray *sortDescriptors = [NSArray arrayWithObjects:codeDescriptor,nameDescriptor,nil];

shareClasses = [[NSArray alloc] initWithArray:[newShareClasses sortedArrayUsingDescriptors:sortDescriptors]];


Please note, that if you sort strings, it is sorted as strings. So if values are 1,2,3…10 …it is sorted:  1,10,2,3,4,5 ….

If you want to sort your array using integer values of strings you can write your own comparator (read about NSComparisonResult) or you can use “tricky” NSNumericSearch function inside your sortDescriptor:

NSSortDescriptor *codeDescriptor = [[[NSSortDescriptor alloc] initWithKey:@"code" ascending:YES selector:@selector(caseInsensitiveCompare:) comparator:^(id obj1, id obj2) { return [obj1 compare:obj2 options:NSNumericSearch]; } ] autorelease];
This is the fastest method and you don't need to convert your string to integer for comparison.



Jak wymusić start aplikacji w trybie landscape

January 9th, 2011 No comments

Aby wymusić tryb landscape musimy w kontrolerze, którego dotyczy operacja ustawić odpowiednią odpowiedź na metodę shouldAutorotateToInterfaceOrientation:

(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (UIInterfaceOrientationIsLandscape(interfaceOrientation));

Jeżeli musimy zadbać o to, aby przy starcie aplikacji nasz ekran Default.png wyświetlał się w orientacji Landscape z uwzględnieniem obydwu wariantów – prawego i lewego. W tym celu w pliku Info.plist musimy dodać parametr:


A dodatkowo, dla zapewnienia poprawnej obsługi prawej i lewej strony:


W przypadku konieczności "przebudowania" widoku przy obrocie aplikacji musimy zadbać o poprawną obsługę metody:

(void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
[self relayoutViews];


How to use SVN in XCode

December 26th, 2010 No comments

It is quite common issue when we need to share our code with other developers or control versions of uploaded files. In corporate environment we usually have installed CVS or SVN. It may be also very helpful to use such environments in small companies or projects. One more advantage can also be, that we have backup on network drive in case of any issue with local storage.

How to install SVN quickly and start using it? The best approach would be to leverage systems delivered by our hosting provider. delivers ‘one-click install’ subversion. We just need to follow instruction displayed on the screen and after few minutes SVN is ready.
If we need just remote storage and files sharing – this is the only step we need to do. Now we need to install client on our machine OR we need to configure XCode.
For more advanced features we may configure additional access and scripts to deploy files on development, testing and production environments. Very good tutorial can be found on the page

There are few Mac clients for subversion. The most similar to Windows Tortoise SVN may be SCPlugin. Installation takes only few minutes and it gives all basic features. Installation is described on the page:

The best approach would be to configure repository directly in XCode. It gives direct access to all needed features and fully supports all features delivered in SCM – repositories management option of XCode. After installation we can use the “Commit” and “Update” commands (when you have files selected in the Groups & Files list) in the “SCM” menu in Xcode to download or upload changes to/from the repository.

To configure XCode:

  1. Open Xcode, and click “Preferences” under “Xcode”
  2. Select “SCM” option
  3. Click button “+” (add) under the “Repositories” to add new entry.
  4. Enter name, url, username and password. Xcode will also fill some wields automatically based on username, url and password.
  5. Choose your new repository from the list. Select it and click the “Checkout” button in the toolbar.

How to create modal screen with save, email, share on facebook ?

October 16th, 2010 No comments

I want to add to my application new view with buttons for sharing content or saving it to disk. I know how to do sharing itself (save, email), but I wonder if this layer should be created as frame or there is any ready-to-use class displaying modal layer for half screen?

As I already know the answer, and it was much easier than I expected, I will share it here. Most programmers will probably find it in Human Interface Guidelines, but I started reading documentation from another documents, which was probably wrong order.
Read more…


Color Picker library for iPhone

October 15th, 2010 No comments

When I created my Pie Chart Creator, I needed a class to display available colors and return clicked color after user selected color.
I created nice library – it may require some adjustments which I will add soon, but I want to share it now with others. Please remember, that it is based on new BSD license, which is explained in a source code and here

Read more…


Jak wysłać email z utworzonym obrazkiem lub widokiem?

October 4th, 2010 No comments

Bardzo często chcemy zachować efekt pracy naszego programu i umożliwić użytkownikowi wysłanie obrazu jako e-mail lub publikacje na portalach społecznościowych. Wbrew pozorom to znacznie łatwiejsza operacja niż się wydaje. Programiści Apple postarali się i można w łatwy sposób zapisać wybrany widok (UIView) jako obraz, a następnie dołączyć go do wiadomości e-mail.
Poniżej gotowy kod, który wystarczy podpiąć do własnego przycisku lub zdarzenia. Należy oczywiście wskazać odpowiedni widok, który chcemy zachować jako obraz.
Read more…