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

Ziner Uses DTCoreText

You know I love to hear from developers who are making good use of my open source or commercial components in released apps. A shining example of lat is Ziner.

Ziner is the latest entry in the battle for the best Google Reader client, fighting it out with other heavyweights Reeder, Feedly, Flipboard, Mr. Reader, FeeddlerRSS and Newsify.

I asked Ziner’s developer Jay Zhao to share with us a bit of the back story of Ziner.

Read more

How to send image to remote server

Somebody asked on StackOverflow:

how to send image to Remote server from the below code last string is placed with image

NSString *reqString=[NSString stringWithFormat:@"http://projeceads.info/spir/productinfo/productadd/%@/%@/%@/%@/%@/%@/%@/%@",ownerId,productNameTxt.text,QuantityTxt.text,sizeTxt.text,ageTxt.text,priceTxt.text,descriptionView.text,imgstr]; NSURL *reqUrl=[NSURL URLWithString:reqString]; NSURLConnection *connection=[[NSURLConnection alloc]initWithRequest:[NSURLRequest requestWithURL:reqUrl] delegate:self];
[connection start]; }

Now there are several things wrong with this question. This is the very first question this person asked on StackOverflow and he didn’t even set a proper user name yet. The code is not formatted as such, the English is bad and to most casual onlookers it is unclear what this question is about.

Still I felt an urge to give a good answer because often it is non-sensical questions like this that challenge our ability to parse the intent of the asking person and our knowledge of the subject matter. It is also such a situation where you can give an answer that exactly matches the question as well as a second answer that is a better way of achieving the intent.

Read more

Apple-converted-space

When using HTML to represent text that the user can edit you will meet a problem: HTML compresses whitespace. Tabs or newlines or even multiple spaces all get compressed to single spaces. That is, unless you enable the same sort of whitespace handling that PRE tags are using.

I was curious how Apple’s own NSHTMLWriter would be avoiding whitespace compression. And there I found a creative approach and adopted the same technique in my DTHTMLWriter which allows you to generate HTML from attributed strings.

Read more

2012 in Review(s)

I recently revealed that app sales only make up about 4% of our company revenues. Because of this we don’t have much budget to invest into our apps and the reasonable view is to see them as glorified hobby projects.

Nevertheless it is nice to go back over the past year in reviews to pick out the ones that transport the best emotions. There are many people who use app reviews as a sounding board for themselves and write things there that they never would say to a developer in person. Thus it is permissible to pick out the few reviews that give us the best feeling and ignore the rest.

Read more

DTCoreText 1.1

Other people take off the Christmas holidays to have fun. I delight in using the time away from normal programming work to work on DTCoreText.

There are many wide-reaching changes to warrant an increase in version number on the second digit. I need to sum them up in this location because you might have projects that rely on DTCoreText for displaying attributed strings.

Read more

DTRichTextEditor 1.1

Over the past week I’ve been working on enhancing DTRichTextEditor and – by extension – some of the enhancements also went into DTCoreText, which is in charge of HTML parsing, generation and display of thusly generated NSAttributedStrings. Today I present version 1.1 which brings these fine enhancements:

Changes

  • ADDED: Support for Undo/Redo
  • ADDED: Setting and changing font family and size for ranges
  • ADDED: Support for indenting
  • CHANGED: Lots of documentation added, refactoring and cleanup
  • FIXED: text scaling bug when pasting
  • UPDATED: DTCoreText + DTFoundation submodules

This work was sponsored by Rick Meyers who is including DTRichTextEditor in his e-Sword HD iPad app.

Read more

Changing History … Git’s

I had my PDF experiments inside DTFoundation. Those included a rather large (compared to the other source code) PDF file I was using for testing and the Demo. The problem with this was that I’m using DTFoundation almost everywhere now, being the central repository for all my generally reusable code.

Because of this file every cloning of the repository would take forever. So I decided to split the PDF stuff into its own repository and I deleted the file. However – since git keeps all history forever – the clones would still take long.

Read more

Airship Commander 1.0

In June we announced that we had begun a private BETA of Airship Commander. Several of our clients had also began to use the app internally to push notifications to users of their apps. Today we are happy to announce that we submitted version 1.0 to Apple for approval.

Read more

Radar: Support Multiple Shadows in NSHTMLWriter

That was an easy Radar for me to file. It’s not a bug, but it is bugging me nevertheless.

I am disturbed by the disparity between the NSShadowAttributeName attribute (which can only hold a single NSShadow) and CSS where you can have multiple shadows. Because NSHTMLWriter simply copies these to the CSS style of a span it should be quite easy to to also let NSHTMLWriter take an array.

It’s not a very important feature to have, but hey … it would give me some peace of mind. ;-)

Filed as Radar#12908144.

Read more

Radar: UITextView Ignores Font Kerning

While researching the root cause for the UITextView line-height bug I also found another difference between attributed strings rendered via CoreText and UITextView. The latter ignores font kerning.

UITextView uses Webkit for displaying attributed strings. Unfortunately Kerning is disabled on Webkit views unless you specify a certain CSS style.

Kerning in Browser

If you look at the AV characters you can see how the version with Kerning enabled has the AV seem at a more natural distance while the lower line has an uncomfortably wide distance between them.

In the Radar (which I filed under #12889869) I argue that when setting text on UITextView via setAttributedString we developers expect for Kerning to be on by default since this is the way that is closest to how CoreText renders it.
Read more