BuySellAds.com

My book Barcodes with iOS 7 is nearing completion. Buy it now to get early access!
Our DNA is written in Objective-C
Jump

DTCalendarView 2.0

When I saw the demo video of Billings Touch it hit me like a cold snowball: it also makes sense to use a calendar to select a date. Billings Touch shows you a nice big calendar view when you select a project due date. Shortly thereafter there was a discussion on date pickers on my favorite forum and the result of this also pointed towards the necessity of having a real calendar replace UIDatePicker.

So I sat down for 2 days straight to surgically remove the calendar-related parts from DTCalendarViewController and put those into their own class DTCalendarView. This enables you to use the view by itself. Also I put my secret sauce UIView+sliding into the project, as a free bonus. This category extension allows you to slide in any kind of UIView from the bottom of the screen. Together with DTCalendarView you get magic: a drop in UIDatePicker replacement!

Additionally to the above new features there where a couple of minor bug fixes and programmability improvements that will make your life as developer much easier. The update for DTCalendarViewController is free of charge for existing customers. To order your access and license go to the Dr. Touch’s Parts Store today!

Dr. Touch #012 – "iPad Aftermath"

A week after Apple announced the iPad the dust has begun to settle. Dr. Touch explores what the iPad really means for us developers.

This episode is brought to you by:

Dr. Touch’s Parts Store – easy to use yet professionally looking components that you can use to spruce up your own apps. Augmented Reality, Calendar Control, Pin Lock or Purchase Button are only some examples. You get full source code, no static library crap, and lifetime support by Dr. Touch himself. Check it out today!

Play

My Show Notes (aka Script) below the break…

Read more

Dr. Touch's Purchase Button

When you get around to adding In App Purchases (IAP) to your app you will find that Apple does not provide anything to help you with the UI. StoreKit only takes care of the buying backend. Therefore I sat down and spent many hours to construct a customizable purchase button to be the latest addition to the Dr. Touch Parts Store.

DTPurchaseButton

This is a button that has three states you need for In App Purchases: Neutral, Confirm and Purchased. For each of these states you can set a text and a title and the button does all the rest. It will send a message to your delegate when the button resizes so that you can move UI elements out of the way. It informs your app if a purchase should be made via StoreKit or whether it was cancelled. DTPurchase Button transmits an especially high value of your IAPs by  using a custom gloss finish.

Have a look at this video demonstration of the part in action:

Price: 100 EUR

You can order this part for use in your own projects via e-mail. See the terms and conditions at the bottom of my store page for the fine print.

Drawing Rounded Rectangles

Once you get deeper into coding iPhone apps you find that CoreGraphics starts to become a real friend. A friend who lacks in certain areas, because you will still have to piece together some shapes with the shape drawing functions that CG provides.

For sake of reusability you want to put the creation of distinct shapes into their own respective methods. You could make those into C functions like their CG brethren, but for our purposes objC-methods suffice.

This method creates a CGPath for a rounded rect inside the given rectangle with the given radius. We are alternating adding a straight line segment and then a corner by means of AddArcToPoint.

- (CGPathRef) newPathForRoundedRect:(CGRect)rect radius:(CGFloat)radius
{
	CGMutablePathRef retPath = CGPathCreateMutable();
 
	CGRect innerRect = CGRectInset(rect, radius, radius);
 
	CGFloat inside_right = innerRect.origin.x + innerRect.size.width;
	CGFloat outside_right = rect.origin.x + rect.size.width;
	CGFloat inside_bottom = innerRect.origin.y + innerRect.size.height;
	CGFloat outside_bottom = rect.origin.y + rect.size.height;
 
	CGFloat inside_top = innerRect.origin.y;
	CGFloat outside_top = rect.origin.y;
	CGFloat outside_left = rect.origin.x;
 
	CGPathMoveToPoint(retPath, NULL, innerRect.origin.x, outside_top);
 
	CGPathAddLineToPoint(retPath, NULL, inside_right, outside_top);
	CGPathAddArcToPoint(retPath, NULL, outside_right, outside_top, outside_right, inside_top, radius);
	CGPathAddLineToPoint(retPath, NULL, outside_right, inside_bottom);
	CGPathAddArcToPoint(retPath, NULL,  outside_right, outside_bottom, inside_right, outside_bottom, radius);
 
	CGPathAddLineToPoint(retPath, NULL, innerRect.origin.x, outside_bottom);
	CGPathAddArcToPoint(retPath, NULL,  outside_left, outside_bottom, outside_left, inside_bottom, radius);
	CGPathAddLineToPoint(retPath, NULL, outside_left, inside_top);
	CGPathAddArcToPoint(retPath, NULL,  outside_left, outside_top, innerRect.origin.x, outside_top, radius);
 
	CGPathCloseSubpath(retPath);
 
	return retPath;
}

The method has to be called new-something so that Build&Analyze does not tell you about a memory leak. Having the method name begin with new tells the static analyzer that this method is supposed to return something that the caller has to take care of releasing.

Now, if we want to use this method, then we can do so in any view’s drawRect:

- (void) drawRect:(CGRect)rect
{
	CGContextRef ctx = UIGraphicsGetCurrentContext();
 
	CGRect frame = self.bounds;
 
	CGPathRef roundedRectPath = [self newPathForRoundedRect:frame radius:5];
 
	[[UIColor blueColor] set];
 
	CGContextAddPath(ctx, roundedRectPath);
	CGContextFillPath(ctx);
 
	CGPathRelease(roundedRectPath);
}

Having the rounded rectangle shape as a path object allows us to reuse it several times. You could for example draw a gradient inside after having used the shape for clipping, then draw a border and also add a shadow. All from the same shape. At the end we just release it to clean up.

UILabels with Neon-Effect

For a customer project I needed to have a Neon glow on some text. Being the geek that I am I would not want to settle for simple creating the effect in Photoshop since I wanted to be able to smoothly scale the text. Custom drawing comes to mind, but where?

One might be tempted to first consider create a new UIView for this effect, but then you’d have to also add all those properties that UILabel has on top of what it inherits from UIView. Second idea was to create a UILabel category, but my experiments have shown if I override a standard method like drawRect in my category then this overrides it for all UILabels.

(Background Photo “Seattle by Night” by Alan Bauer)

So the final – and successful – decision was to subclass UILabel: DTGlowingLabel was born.

Read more

Apple Q1 2010 Conference Call Summary

These are my notes for a quick summary of what was interesting for us iPhone Developers.

iPhone Sales

  • over 8.7 Million iPhones sold in Quarter
  • = Company Record
  • = 100% increase over prior December quarter
  • 17 new carriers
  • iPhone now in 68 countries

Apple generally focussed on cash generation and “short dated high quality investments”.

New Accounting Principles applied retroactively: No longer revenue/cost deferred for future updates. Apple has a tax rate of about 29%.

Apple very satisfied with their “New Product” Pipeline. 33% Mac Growth Rate (= 2 times the market) “very confident about the pipeline”

Q&A

What are their feelings on having a single carrier in the US?

AT&T is a “great partner”, worked with them since well before iPhone. “Some issues in a few cities”, AT&T has “detailed plans to address these”

Development of prices

  • higher component prices environment (DRAM, other components overcapacity depleted)
  • seasonal decline in revenue
  • US dollar strengthened

App Review Process Problems

Important to keep perspective: 100.000 apps, 90% apps approved within 14 days. Make sure it protected consumer privacy, children. Porn rejected outright. Rejections are mostly bugs. Noise higher than reality.

About future products

“Stay Tuned.”

“Wouldn’t want to take away your joy of surprise on Wednesday.”

App Store

Way ahead of competitors. Dwarfing them.

Lala, Quattro Acquisitions:

Offer seamless way for app developers to make more money, for technology and talent.

About relationship with Google

“We work with Google work with in some areas, compete in others. Mobile Ads in infancy. We’ll see where that takes us.”

Education

“We really understand teaching and learning and student achievement at a very deep level. And I think we’re the only technology company that really gets it. We sell a lot more than just boxes as many other people do. I think we are staying very focussed on that market.”

Dr. Touch #011 – "Waiting for iSlate"

Now in the final days before the next big Apple event there are no real news. The contest seems to currently be who can come up with the coolest iSlate rumors.

Play

The show notes aka my script you find after the break.

Read more

Dr. Touch's incredible POI Weight Loss Formula

I’ve been busily hacking away on this for the past week and now I have reached the level where I can formally announce this new addition to Dr. Touch’s Parts Store.

I was approached a week ago by somebody who suggest this to be sold as an inexpensive component and I immediately was intrigued by the problem. Imagine that you have an iPhone app which displays lots of PINs in a very restricted area. Naturally shops would be very close to each other causing the resulting annotation PINs to overlap. DTClusterMaker, the new component, aims to address this problem.

Without it your screen might look like this:

After a quick optimization with DTClusterMaker this mess turns into something much ligther, much nicer to look at:

I hope that you agree that the second view would be the preferred variant. This way you can still see the name of the city in question: München (= Munich).

DTClusterMaker employs a very efficient method to spatially sort and cluster closeby POIs. In the presented demonstration app you can explode any of the purple pins into it’s original POIs. You get two different algorithms to choose from: The perfect one, that tends to slow down if you feed it hundrets of POIs. And it’s ultra-fast cousin which works by “boxing” the POIs. It’s so fast in fact, that I am thinking of letting it run multiple times with a shifted grid and then choose the output that gives me the smallest number of POIs. If you have hundreds of POIs then you won’t see a difference.

DTClusterMaker is available now for you to purchase at an introductory price of 100 Euros. It still needs a bit of work in getting the interface to your code ironed out, but as with all components your access to the SVN repository where it is being developed insures that you get all those improvements for free. Also I am depending on your requirements to figure out the most elegant way to interact with the ultimate POI weight loss formula. :-)

Array Self-Sorting

The current Dr. Touch Part that I am working on for my store is about quickly clustering POIs if they would be too close together on a MKMapView. For this purpose I need to calculate distances between all annotation pins and add to this the distances to all newly found clusters. Currently this involves resorting the whole list of distances multiple times. So I put my thinking hat on and built this category extension for NSMutableArray to add numbers of objects in the correct place according to the specified sort order.

To cut down on search time for the insertion point I am using a “divide an conquer” approach. Split the search range in half and check if the value at this index is bigger or smaller than the one I am trying to insert. Continue to divide until the length of my search range is 0. At that point I have found the appropriate place for the insertion.

This approach means that for 1000 values/objects in the array only 10 comparisons are necessary. This is most likely way less than if you are constantly creating sorted copies of the array with one of the three standard sorting methods.

Read more

Business as Unusual

If you follow my capers then you will remember that I changed to full-time on all my iPhone-releated activities at beginning of December. Now with the turn of the century I took on two chores that I was putting off for quite some time, even though I was fully aware that their completion would be benefitial to my immediate business development.

The first was to structure and formally open my Dr. Touch’s Parts Store where I am offering professional-grade software components to spruce up your own apps. The second I just finished, it’s a page which details all the contracted apps I made in the past so that you can see the whole spectrum of apps I made in the past year.

Yesterday I set up my Drobnik KG business stationary in Billings so that I don’t have to write my invoices with Microsoft Word any more. So as of today I am announcing the full availability of the entire spectrum of my professional offerings.

Professional Services

My mission is to be a grade A iPhone Development services provider. As such these are my offerings:

  • Wholly Owned Applications – providing a steady basis for my cashflow
  • Contract Applications – experience in serious app development
  • Partnerships – exchanging knowledge and resources for part of the earnings, depending on the degree of my involvement between 20% and 50% of royalties
  • Troubleshooting, Coaching and Development Training – either in person or via screen sharing
  • Pre-Submission Inspection of your code – eliminate reasons why Apple might reject your app
  • Dr. Touch Podcast – Concise News and Commentary relevant for iPhone Developers
  • Dr. Touch’s Parts Store – Professional grade software components to spruce up your own apps
  • Project Management and Staffing of outsourced projects – if I don’t have the capacity then I know where to get it.

“Nuts and Bolts”

Personally I am especially interested in developing solutions for tricky logical scenarios. If you need something done, that falls into this “interesting” category, then you have two options with me:

  1. I can develop it exclusively for you, with you bearing the fullest extent of my development costs. Then you are the only one who can use my code in your apps.
  2. If it is a component of broader interest then you can suggest development of a Dr. Touch Part. When I am selling this component you will be able to get the resulting Part at a fraction of the total cost because development is paid for by multiple customers.

Partnerships

About partnering … I have 3 apps in the app store where I am sharing profits with a partner, depending on my involvement:

Having just opened for business I still have to look primarily to get a positive bottom line for each month. Therefore I cannot afford to enter into any partnerships where I am asked to develop an app for multiple weeks to maybe get a payoff after the app might (or might not) become a big hit.

The partnership model that I am most likely to be considering is that my partner fronts the development costs and gets full (or a major portion of) royalties until he has recovered his costs. From that time onward we are sharing 50:50.

Connecting People

My blog has about 500 unique visitors per day, I have over 1100 iPhone-targeted followers on twitter, my podcast so far has about 100 subscribers on iTunes. Over 600 people have donated in support for my causes to keep iPhone piracy at bay and provide a mobile way to aggregrate your sales reports.

I like to communicate and help out where possible to help the iPhone community as a whole. So if you need to get the word out about something that might interest the whole iPhone world then don’t hesitate to contact me.