2012/05/16
How to make both ends rounded line
I wanted to make a line whose both ends are round. I have drawn lines but never tried this, so I asked Mr. Google and I got the answer.

The code is here :
The default value is kCGLineCapButt.

The code is here :
float xx = 20.f;
float yy = 100.f;
CGContextSetLineWidth(context, 20.f);
CGContextSetRGBStrokeColor(context, 1.f, 0.7f, 0.5f , 1.0);
CGContextSetLineCap(context , kCGLineCapButt);//default
CGContextMoveToPoint(context, xx, yy);
CGContextAddLineToPoint(context, xx+100, yy);
CGContextStrokePath(context);
CGContextSetLineCap(context , kCGLineCapRound);
CGContextMoveToPoint(context, xx, yy+30.f);
CGContextAddLineToPoint(context, xx+100, yy+30.f);
CGContextStrokePath(context);
CGContextSetLineCap(context , kCGLineCapSquare);
CGContextMoveToPoint(context, xx, yy+60.f);
CGContextAddLineToPoint(context, xx+100, yy+60.f);
CGContextStrokePath(context);
The default value is kCGLineCapButt.
2012/05/10
NSString method to get a part of text
NSString *string = @"20120510";When I have a text above and I want to get a part of it.
I have been using the next method in my app "Baby Growth Chart" :
- (void)getCharacters:(unichar *)buffer range:(NSRange)aRangeMy app exactly has this code but I don't know 'unichar'…
These days I found a next other method :
- (NSString *)substringWithRange:(NSRange)aRangeI can understand this method! I set a range and its return value is NSString, well this is very easy to understand!
This method is available in iOS 2.0 and later, I should have used this!
I got texts what I want as next :
NSString *day = [string substringWithRange:NSMakeRange(string.length-2,2)]; NSString *month = [string substringWithRange:NSMakeRange(string.length-4,2)]; NSString *year = [string substringWithRange:NSMakeRange(string.length-8,4)];
2012/05/08
iOS 5.1.1 has come
I found this morning that the new version of iOS had come.
New one may be fixed about HDR option?
I like photos taken by HDR option, because they are really beautiful, but some photos has something strange like this :

I hope this kind of trouble were fixed in this new version.
New one may be fixed about HDR option?
I like photos taken by HDR option, because they are really beautiful, but some photos has something strange like this :

I hope this kind of trouble were fixed in this new version.
2012/05/03
How to change language while running
My app 'Baby Growth Chart' have some Localized.strings files, and I want to change the language in code (not device settings).
Because some users say
The sentences in your app are a little bit strange, therefore show in English!
Sorry! I know that, because most languages (except English and Japanese) are automatically created by one translation webpage.
Anyway, I have already some Localized.strings files in my code and I want to change the language while the app is running.
I found two ways to do so.
The first way
A very simple way. Just put next code :
[[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObjects:@"en", nil] forKey:@"AppleLanguages"];
This code sets the language English from your default language.
But this did not work if I put this code some places. It may be good to put
application:didFinishLaunchingWithOptions:
method. But it did not work if I put this in a method which was called when the language change button was tapped.
It is ideal to change the language instantly after the change button was tapped.
The second way
iphone - How to force NSLocalizedString to use a specific language - Stack Overflow
I found it in the famous website as usual.
This way sends a message to NSBundle object and gets strings in Localized.strings .
It did work! Very fine! But I have many codes to replace!
Because some users say
The sentences in your app are a little bit strange, therefore show in English!
Sorry! I know that, because most languages (except English and Japanese) are automatically created by one translation webpage.
Anyway, I have already some Localized.strings files in my code and I want to change the language while the app is running.
I found two ways to do so.
The first way
A very simple way. Just put next code :
[[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObjects:@"en", nil] forKey:@"AppleLanguages"];
This code sets the language English from your default language.
But this did not work if I put this code some places. It may be good to put
application:didFinishLaunchingWithOptions:
method. But it did not work if I put this in a method which was called when the language change button was tapped.
It is ideal to change the language instantly after the change button was tapped.

iphone - How to force NSLocalizedString to use a specific language - Stack Overflow
I found it in the famous website as usual.
This way sends a message to NSBundle object and gets strings in Localized.strings .
It did work! Very fine! But I have many codes to replace!
2012/04/25
Sample images of Navigation Bar for graphic designers
I have been making a clock app, and I'm going to ask for its graphic design at one web site where I can find a good graphic designer.
So now I'm making web pages which explains my app.

This is a screenshot of the app and this has a navigation bar as you see. I want a graphic designer to decide only its tintColor property about this bar.
But I guess graphic designers usually don't know Xcode nor cocoa frameworks. So how can they decide its tintColor?
I have no idea except showing sample images of the bar, therefore I made one Xcode project to create png-images of the bar.
The bars were created in slightly different color. I set each RGB color 0, 0.2, 0.4, 0.6, 0.8, 1.0, so 6 patterns and 3 colors equals 216 images!
This is a screenshot of the web page.

I hope this page works.
If you have any other good idea, please tell me!
So now I'm making web pages which explains my app.

This is a screenshot of the app and this has a navigation bar as you see. I want a graphic designer to decide only its tintColor property about this bar.
But I guess graphic designers usually don't know Xcode nor cocoa frameworks. So how can they decide its tintColor?
I have no idea except showing sample images of the bar, therefore I made one Xcode project to create png-images of the bar.
The bars were created in slightly different color. I set each RGB color 0, 0.2, 0.4, 0.6, 0.8, 1.0, so 6 patterns and 3 colors equals 216 images!
This is a screenshot of the web page.

I hope this page works.
If you have any other good idea, please tell me!

