http://www.developers-life.com Develop on Objective-C, UIKit, C, OpenGL for iPhone, iPad, Mac OS X Thu, 10 Nov 2011 20:43:27 +0000 en hourly 1 http://wordpress.org/?v=3.2.1 http://www.developers-life.com/nsregularexpression-sample-for-comment-syntax-highlighting.html http://www.developers-life.com/nsregularexpression-sample-for-comment-syntax-highlighting.html#comments Tue, 08 Nov 2011 00:25:10 +0000 Vladimir Boychentsov http://www.developers-life.com/?p=1321 I have this text: 1 word1 word2 " word3 //" word4 I wrote simple solution. I know it can be better. I know about Back Reference, but i don’t have experience with it. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 NSRegularExpression * expression = [ NSRegularExpression regularExpressionWithPattern : @ "((@ \" | \" ).*?( \" ))" options : NSRegularExpressionDotMatchesLineSeparators error : nil ] ; NSArray [http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/] * textArray = [ expression matchesInString : textString options : 0 range : NSMakeRange ( 0 , [ textString length ] ) ] ; for ( NSTextCheckingResult * result in textArray ) { // set color for range } // Comments expression = [ NSRegularExpression regularExpressionWithPattern : @ "(//[^ \" \n ]*)" options : 0 error : nil ] ; NSArray * arrayComments = [ expression matchesInString : textString options : 0 range : NSMakeRange ( 0 , [ textString length ] ) ] ; for ( NSTextCheckingResult * resultComment in arrayComments ) { BOOL inside = NO ; for ( NSTextCheckingResult * resultText in textArray ) { NSInteger from = resultText.range.location; NSInteger to = resultText.range.location + resultText.range.length; NSInteger now = resultComment.range.location; if ( from < now && now < to ) { inside = YES ; break ; } } if ( ! inside ) { // set color for range } } ]]> http://www.developers-life.com/nsregularexpression-sample-for-comment-syntax-highlighting.html/feed 0 http://www.developers-life.com/simple-ekdemo-ekevent.html http://www.developers-life.com/simple-ekdemo-ekevent.html#comments Sun, 06 Nov 2011 00:28:57 +0000 Vladimir Boychentsov http://www.developers-life.com/?p=1315 Now we have controller for creating events. This controller included from 4.0 iOS SDK. SimpleEKDemo The application uses table views to display EKCalendar object and EKEvent objects retrieved from an EKEventStore object. It implements EKEventViewController for viewing and editing existing EKEvents, and uses EKEventEditViewController for creating new EKEvents. ]]> http://www.developers-life.com/simple-ekdemo-ekevent.html/feed 0 http://www.developers-life.com/ddprogressview-custom-progress-view.html http://www.developers-life.com/ddprogressview-custom-progress-view.html#comments Sat, 05 Nov 2011 15:47:23 +0000 Vladimir Boychentsov http://www.developers-life.com/?p=1310 DDProgressView is a custom progress view à la Twitter for iPhone. DDProgressView works on both iOS and Mac OS. You must also compile the AppKitCompatibility.m file when targeting Mac OS. Thanks, Damien DeVille ! ]]> http://www.developers-life.com/ddprogressview-custom-progress-view.html/feed 0 http://www.developers-life.com/my-custom-uitextview.html http://www.developers-life.com/my-custom-uitextview.html#comments Sat, 05 Nov 2011 00:51:21 +0000 Vladimir Boychentsov http://www.developers-life.com/?p=1306 ]]> http://www.developers-life.com/my-custom-uitextview.html/feed 1 http://www.developers-life.com/color-picker-for-ios.html http://www.developers-life.com/color-picker-for-ios.html#comments Sat, 29 Oct 2011 12:17:25 +0000 Vladimir Boychentsov http://www.developers-life.com/?p=1302 Example: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 - ( void ) viewDidLoad { [ super viewDidLoad ] ; // Do any additional setup after loading the view, typically from a nib. if ( self.cPicker == nil ) { [ self.view setBackgroundColor : [ UIColor grayColor ] ] ; self.cPicker = [ [ VBColorPicker alloc ] initWithFrame : CGRectMake ( 0 , 0 , 202 , 202 ) ] ; [ _cPicker setCenter : self.view.center ] ; [ self.view addSubview : _cPicker ] ; [ _cPicker setDelegate : self ] ; [ _cPicker showPicker ] ; // set default YES! [ _cPicker setHideAfterSelection : NO ] ; } } // set color from picker - ( void ) pickedColor : ( UIColor * ) color { [ _rect setBackgroundColor : color ] ; [ _cPicker hidePicker ] ; } - ( void ) touchesBegan : ( NSSet * ) touches withEvent : ( UIEvent * ) event { if ( ! [ _cPicker isHidden ] ) { [ _cPicker hidePicker ] ; } } // show picker by double touch - ( void ) touchesEnded : ( NSSet * ) touches withEvent : ( UIEvent * ) event { UITouch * touch = [ touches anyObject ] ; if ( touch.tapCount == 2 ) { [ _cPicker setCenter : [ touch locationInView : self.view ] ] ; [ _cPicker showPicker ] ; } } ]]> http://www.developers-life.com/color-picker-for-ios.html/feed 0 http://www.developers-life.com/sorting-by-block.html http://www.developers-life.com/sorting-by-block.html#comments Sat, 22 Oct 2011 19:17:30 +0000 Vladimir Boychentsov http://www.developers-life.com/?p=1296 Sorting by block 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 NSArray * stringsArray = [ NSArray arrayWithObjects : @ "string 1" , @ "String 21" , @ "string 12" , @ "String 11" , @ "String 02" , nil ] ; static NSStringCompareOptions comparisonOptions = NSCaseInsensitiveSearch | NSNumericSearch | NSWidthInsensitiveSearch | NSForcedOrderingSearch; NSLocale * currentLocale = [ NSLocale currentLocale ] ; NSComparator finderSortBlock = ^ ( id string1, id string2 ) { NSRange string1Range = NSMakeRange ( 0 , [ string1 length ] ) ; return [ string1 compare : string2 options : comparisonOptions range : string1Range locale : currentLocale ] ; } ; NSArray * finderSortArray = [ stringsArray sortedArrayUsingComparator : finderSortBlock ] ; NSLog ( @ "finderSortArray: %@" , finderSortArray ) ; Result: /* Output: finderSortArray: ( “string 1″, “String 02″, “String 11″, “string 12″, “String 21″ ) */ ]]> http://www.developers-life.com/sorting-by-block.html/feed 0 http://www.developers-life.com/getting-font-metrics.html http://www.developers-life.com/getting-font-metrics.html#comments Sat, 22 Oct 2011 19:11:16 +0000 Vladimir Boychentsov http://www.developers-life.com/?p=1292 Doc about font metric Getting Font Metrics ]]> http://www.developers-life.com/getting-font-metrics.html/feed 0 http://www.developers-life.com/tweeting-example-of-apple.html http://www.developers-life.com/tweeting-example-of-apple.html#comments Wed, 05 Oct 2011 11:51:43 +0000 Vladimir Boychentsov http://www.developers-life.com/?p=1289 Tweeting ]]> http://www.developers-life.com/tweeting-example-of-apple.html/feed 0 http://www.developers-life.com/geo-photo-info-editor.html http://www.developers-life.com/geo-photo-info-editor.html#comments Sun, 21 Aug 2011 21:17:26 +0000 Vladimir Boychentsov http://www.developers-life.com/?p=1284 “Geo” renamed to “Photo Info Editor” alpha 1.0.1 Added Sparkle updater. Download Photo taken on Nikkon photo cam without GPS. Original date in NSDatePicker of photo. ]]> http://www.developers-life.com/geo-photo-info-editor.html/feed 0 http://www.developers-life.com/get-geo-tags-from-image.html http://www.developers-life.com/get-geo-tags-from-image.html#comments Wed, 17 Aug 2011 22:22:44 +0000 Vladimir Boychentsov http://www.developers-life.com/?p=1274 Little application for getting geo location from photo Download Application ]]> http://www.developers-life.com/get-geo-tags-from-image.html/feed 0