Skip to main content

Posts

Showing posts from November, 2013

How to stop every app you purchase downloading to your iPad, iPhone or iPod

If you've more than one iOS device or you purchase apps through the desktop version of iTunes and find that your other device keeps downloading the same apps when you don't want it to, then on your iOS device: (1) open the Settings app (2) scroll down and tap iTunes & App Store (3) slide all "Automatic Downloads" (Music, Apps, Books, Updates) to the left to turn off Follow @sketchytech

UIWebView pagination in iOS 7 (Xcode)

Newly added to iOS 7 is the ability to paginate your UIWebView left to right and in other directions as well. See this post for a handy three lines of code to get this working (scroll down to the Native Web App Development section, beneath which you'll see 'Paginate Mode' instructions). You can also find details in Apple's UIWebView documentation and you might well wish to add hyphenation to your css to make this even more book like. (See also Mozilla's guide to hyphens .) Follow @sketchytech

JavaScriptCore Framework for iOS 7

I only stumbled across this by chance. Matt Neuburg mentions it in his latest book on Programming iOS 7 published by O'Reilly: “New in iOS 7, your Objective-C code can load a JavaScript virtual machine and communicate back and forth between JavaScript and Objective-C. See Apple’s JavaScriptCore Framework Reference (currently documented only for OS X, not iOS). I don’t think this has anything to do with UIWebView per se, but it’s so cool that I couldn’t resist mentioning it.” and this blog post  goes into more detail. See also Apple's JavaScriptCore Framework guide for OS X , there is no guide for the iOS 7 implementation yet. Update Apple's explanation of the JavaScriptCore framework is as follows: The JavaScript Core framework (JavaScriptCore.framework) provides Objective-C wrapper classes for many standard JavaScript objects. Use this framework to evaluate JavaScript code and to parse JSON data. For information about the classes of this framework, see the head

Yesterday's dream: Open File Formats

The creation of OpenOffice was instrumental in the creation of more open and interchangeable XML-based office formats. This should be a source of celebration, but now the goal of OpenOffice has largely been achieved, the goal shifts. With the advent of apps, the focus is on what can be uniquely achieved in one app vs another. And unique apps demand unique file formats, think .pages, .garageband, .idraw and so on. This use of unique files is something Apple encourages and supports in its operating systems. This doesn't mean that every app is an island, but instead that apps have unique file types in order to achieve their goals in the most efficient way possible, but then often have interchange formats for use on the desktop and so on. Depending on the app and its role these interchange formats might be: SVG, PDF, .docx, RTF, etc. For those involved in data preservation, this might sound like a bad thing, since unconverted files from apps that disappear into the ether might

Is the future of eBooks RTF?

Displaying RTF (and RTFD) text in an app With the advent of iOS 7 things are changing inside Apple's mobile operating system a good deal when it comes to the display of text. For example, you can now create an RTF file in TextEdit, style it with bold and itals, etc. on a Mac and even drop an image into that file. The display of that file is then possible with a trivial amount of code: NSURL *rtfString = [[NSBundle mainBundle]                          URLForResource: @"helloworld" withExtension:@"rtfd"]; NSAttributedString *stringWithRTFAttributes = [[NSAttributedString alloc]   initWithFileURL:rtfString options:@{NSDocumentTypeDocumentAttribute:NSRTFDTextDocumentType} documentAttributes:nil error:nil];     // Instantiate UITextView object textView = [[UITextView alloc] initWithFrame:CGRectMake(20,20,self.view.frame.size.width,self.view.frame.size.height)];     textView.attributedText=stringWithRTFAttributes;     [self.view addSubview:textView]; A

Creating an NSAttributedString from HTML (or RTF) in iOS 7 (Xcode) - Updated for Swift

Following additions to the iOS 7 NSAttributedString class it is now possible to create attributed strings using HTML. For example: NSURL *htmlString = [[NSBundle mainBundle] URLForResource: @"helloworld" withExtension:@"html"]; NSAttributedString *stringWithHTMLAttributes = [[NSAttributedString alloc]   initWithFileURL:htmlString options:@{NSDocumentTypeDocumentAttribute:NSHTMLTextDocumentType} documentAttributes:nil error:nil]; // Instantiate UITextView object UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(20,20,self.view.frame.size.width,self.view.frame.size.height)]; textView.attributedText=stringWithHTMLAttributes; [self.view addSubview:textView]; Two things to note here: (1) this is a rough and ready use of UITextView - see this earlier post for a better implementation (2) you'll need to save an accompanying file called 'helloworld.html' for this to work. Here is the helloworld.html file: <html><p>

Paging and paginating the easy way with UITextView and UIScrollView in iOS 7 (Xcode)

Following yesterday's post on the right way to use UITextView, I wanted to put it together with the contents of an earlier post on UIScrollView in order to show how simple it is to let iOS 7 work out the pagination for you. I'm not going to hold your hand in this post, instead I'll ask you to refer back to the two earlier posts if there's something that isn't clear in the following code and its comments: // Create a scroll view UIScrollView *scrollingView = [[UIScrollView alloc] initWithFrame:CGRectMake(20,20,self.view.bounds.size.width-20,self.view.bounds.size.height-20)]; // Make the scroll view content size big enough for four pages scrollingView.contentSize  = CGSizeMake((self.view.bounds.size.width-20)*4,self.view.bounds.size.height-20); // Enable paging in scroll view scrollingView.pagingEnabled = YES; // Add scroll view to view [self.view addSubview:scrollingView];     // Create string - content NSAttributedString *textString =  [[NSA

Making the Most of UITextView in iOS 7: NSTextStorage, NSLayoutManager, NSTextContainer and NSAttributedString

Most likely if you're using UITextView then you'll want to take advantage of attributed (or styled) strings. So let's create a NSAttributedString first of all: NSAttributedString *textString =  [[NSAttributedString alloc] initWithString:@"Hello World" attributes:@{NSFontAttributeName: [UIFont fontWithName:@"HoeflerText-Italic" size:12]}]; Now, it might seem convenient to create a UITextView and add the attributed string like this: UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(20, 20, self.view.bounds.size.width, self.view.bounds.size.height)];   textView.attributedText=textString; [self.view addSubview:textView]; But that would be the wrong thing to do if we want to take maximum advantage of all the classes, methods and delegates available to us when using UITextView. So what should be done first is to add the attributed string into a NSTextStorage object: NSTextStorage *textStorage = [[NSTextStorage alloc] init

iCloud, Mavericks and iOS 5, 6 and 7 - How to keep Pages, Numbers and Keynote in sync

When you update to the latest version of Pages, Numbers or Keynote for iOS 7 you'll be warned upon opening apps that the file will be converted into the latest format that can only be opened in the latest version of the iWork app in question and that it will only be possible to open this on a desktop using Mavericks in combination with the updated versions of Pages, Numbers or Keynote. If you are running iOS 7 but an earlier version of OS X prior to Mavericks you'll probably have to do a dance of downloading the Word version of your docs from iCloud via Safari to work with them in Pages '09, for example, or else not update Pages for iOS. However, if you are running Mavericks but not iOS 7 then you can still take advantage of the new Pages and other iWork apps without as much fuss. This is because: When you install the updated apps in Mavericks a folder is created in your Applications folder called iWork '09 and here you'll find all the '09 versions as the

What to do if Adobe Creative Cloud tells you to quit AdobeCrashDaemon before you can install an update (OS X)?

AdobeCrashDaemon isn't a Creative Cloud app, it doesn't run and exist like all the others, so you can't just quit it. Thankfully, there is solution (or two). You can either visit this thread or try the solution that worked for me: Quit all running Adobe apps Go to Applications > Utilities and open the Activity Monitor app Type adobe_licutil in the search box Double-click on adobe_licutil  Select 'Quit' All should now run as expected. Follow @sketchytech