Posts

How to Turn One Travel Photo into a Seamless Instagram Carousel with CaroMix

Image
  A red canoe sits at the far edge of a mountain lake. Crop the photo to fit one Instagram slide and you might lose the canoe or the shoreline that leads your eye to it. A three-slide carousel gives the whole scene room to unfold. Give each swipe something to reveal We built CaroMix so you can lay out a photo across several slides on one canvas. Here’s how to try it with a wide shot from your own camera roll. Pick a photo with a path through it. A shoreline, a winding street or a row of market stalls gives the reader something to follow from left to right. Compose across three slides. In CaroMix, extend the photo across the canvas. In the lake example, the trees frame the opening slide, the peaks fill the middle and the canoe gives the last swipe a destination. Adjust the photo so your main subject sits clear of a slide edge. Export and swipe through. Export the slides, select them in order for your Instagram post and check the preview. Follow one detail across e...

Swift: Understanding Mutating Functions

 classes are reference type whereas structures and enumerations are value types. The properties of value types cannot be modified within its instance methods by default. In order to modify the properties of a value type, you have to use the mutating keyword in the instance method. With this keyword, your method can then have the ability to mutate the values of the properties and write it back to the original structure when the method implementation ends. Below is a simple implementation of Stack in Swift that illustrates the use of mutating functions.     struct Stack { public private ( set ) var items = [ Int ] ( ) // Empty items array mutating func push ( _ item : Int ) { items . append ( item ) } mutating func pop ( ) - > Int ? { if ! items . isEmpty { return items . removeLast ( ) } return nil } } var stack = Stack ( ) stack . push ( 4 ) stack . push ( 78 ) stack . ...

Reverting all Xcode settings to default settings

This is the officially recommended way to delta Xcode 5's preferences, type in Terminal.app: defaults delete com . apple . dt . Xcode   That should restore Xcode to the state of its first launch. (for older versions of Xcode the command was defaults delete com.apple.Xcode , i.e. without the dt in the middle).

Creating Custom URL schemes in iOS/iPhone

Image
iPhone apps can also specify their own custom URL scheme (for example, myapp://doStuff). When might you want to use a custom URL scheme for your app? To transfer data from your app to your  another app To allow other apps (or even web pages) to call your app (and send data to it) To handle callbacks for custom authentication (such as OAuth ) and third party API's Implementing a Custom URL Scheme   The first step is to create a custom URL scheme – start by locating and clicking on the project info.plist in the Xcode Project Navigator. With the plist displayed in the right pane, right click on the list and select Add Row : From the list presented scroll down and select URL types .  Select URL Types for the new item. Once that's added, click the grey arrow next to "URL Types" to show "Item 0". Set your URL identifier to a unique string - something like com.yourcompany.yourappname.    After you've set the URL identifier, sele...

Add shadow to text in UITextView

Image
    NSShadow * shadow = [[NSShadow alloc] init];     shadow.shadowColor = [UIColor blackColor];     shadow.shadowOffset = CGSizeMake(1, 2);        NSDictionary * textAttributes =  @{                                        NSForegroundColorAttributeName : [UIColor blueColor],                                        NSShadowAttributeName          : shadow,                       ...

Disable iPhoto auto launch when connecting an iPhone / iPad

Image
Plug in your iPhone/iPad Open application "Image capture" Select your iPhone/iPad device Press the triangle in square symbol in the lower left corner. Choose "No application" in the drop-list under "Connecting this iPhone opens:"  

add small image after text in UILabel

NSTextAttachment * attachment = [[ NSTextAttachment alloc ] init ]; attachment . image = [ UIImage imageNamed :@ "myimage.png" ]; NSAttributedString * attachmentString = [ NSAttributedString attributedStringWithAttachment : attachment ]; NSMutableAttributedString * myString = [[ NSMutableAttributedString alloc ] initWithString :@ "My label text" ]; [ myString appendAttributedString : attachmentString ]; myLabel . attributedText = myString ;