Tag Archives: iOS

Render iOS App Icons from one SVG Image

#!/bin/sh # # Copyright (c) 2015-2016 Marcus Rohrmoser http://mro.name/~me. All rights reserved. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) […]

MKTileOverlay with gdal2tiles or other TMS tiles

from iOS 7.0 onward there’s the neat MKTileOverlay::initWithURLTemplate: for tiled overlay maps. Sadly it can’t display old-school Tile Map Service maps as e.g. produced by gdal2tiles.py1) because the y-values are flipped upside down. The OSM Wiki says about this fact: „This is really just an unfortunate historical misalignment.“ But with the drop-in MKTileOverlay replacement below, you can […]

App ShaarliOS im Store

brandneu für einen Euro im App Store ist meine ‚Share Extension‘ für iOS 8+ und Shaarli. Und – das ist ein Experiment – gleichzeitig als GPLv3 Free Software bei github. Bin gespannt.

Autolayout: change constraint multiplier

the NSLayoutConstraint multiplier property is read-only. But if you need to change it, you can replace the constraint with a modified clone like @implementation NSLayoutConstraint(ChangeMultiplier) // visal form center http://stackoverflow.com/a/13148012/349514 -(NSLayoutConstraint *)constraintWithMultiplier:(CGFloat)multiplier { return [NSLayoutConstraint constraintWithItem:self.firstItem attribute:self.firstAttribute relatedBy:self.relation toItem:self.secondItem attribute:self.secondAttribute multiplier:multiplier constant:self.constant]; } @end@implementation NSLayoutConstraint(ChangeMultiplier) // visal form center http://stackoverflow.com/a/13148012/349514 -(NSLayoutConstraint *)constraintWithMultiplier:(CGFloat)multiplier { return [NSLayoutConstraint […]

Download WWDC2014 session pdf + mov

. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 #!/bin/sh cd "$(dirname "$0")"   PREFIX=wwdc2014 bwlimit="1000K"   for url in $(curl https://developer.apple.com/videos/wwdc/2014/ | egrep -hoe ‚[^"]+.pdf[^"]+’) do dst="$PREFIX/$(basename $url ?dl=1)" echo "$dst" curl –output "$dst" –time-cond "$dst" –remote-time –silent –create-dirs –location –limit-rate "$bwlimit" –url […]

Catch JavaScript exceptions in UIWebViews

A small but useful category method on UIWebView: Turn uncaught JavaScript Exception into a NSError! // // Created by Marcus Rohrmoser on 05.12.13. // Copyright (c) 2013 Marcus Rohrmoser mobile Software. All rights reserved. //   #import "UIWebView+JavaScriptNSError.h"   #define NSERROR_UIWEBVIEW_SCRIPT @"NSERROR_UIWEBVIEW_SCRIPT" #define NSERROR_UIWEBVIEW_SCRIPT_CODE 1   @implementation UIWebView(JavaScriptNSError)   -(NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script error:(NSError * __autoreleasing *)error […]

git version sha in iOS apps

there’s tons of recipes out there how to do this – nevertheless I want to add another one: create a new build phase (here named „Git Sha -> Info.plist“) paste 1 2 3 4 5 6 7 8 # write git version SHA into Info.plist # # inspired by # – http://kswizz.com/post/2686511526/git-xcode-versioning # – http://stackoverflow.com/a/12658311 […]

Rank sql(ite) text search results

When searching for text snippets in sql databases you might want to rank the results according to „how good did it match“. And: the ranking shouldn’t make the query slower. Let’s take a simple example using the LIKE operator. (I know, FTS does a better job, but let’s stick to like for now). Assume the […]

Upgrade iOS SDK 4.0 -> 4.1 with custom location

again, for my custom install location I need to prepare: cleanly uninstall and remove cruft: $ dir=/Users/Developer.SnowLeopard $ sudo sh $dir/Library/uninstall-devtools $ sudo rm -r $dir/* $ sudo mv /Developer /Developer.deleteme$ dir=/Users/Developer.SnowLeopard $ sudo sh $dir/Library/uninstall-devtools $ sudo rm -r $dir/* $ sudo mv /Developer /Developer.deleteme then do the custom-location install and finally restore some […]

UILabel with a (custom) CGFont

UILabel’s font property accepts UIFonts – but strange enough there’s no way to get a custom loaded CGFont (from a ttf or otf file) converted into such an UIFont. You’re stuck with the iPhone’s pre-installed fonts – at least when you have to support iOS 3.0 devices. After googling a bit and searching Stackoverflow I found […]