- Here is an excellent WWDC presentation from 2013 on custom transitions between view controllers. Incredibly powerful API, especially when coupled with gesture recognizers.
- This StackOverflow response goes in-deptb about to use this API to create custom gesture-driven transitions.
- Here’s a succinct library compatible with Interface Builder for creating badges.
- I needed to get a count for my enum, but I didn’t want to have to make “count” a case in my enum because then I’d always have to define either it or the default case to avoid errors. I found exactly the solution I was looking for in the comments of this StackOverflow: if you can make your enum an Int and the first value zero, make count a function which returns the raw value of the last case.
- ActionSheetPicker-3.0 is a Swift-ready library for presenting UIPickerViews “as” UIAlertViews.
Tag: iOS development links
iOS development links: September 22nd, 2016
- A quick reminder of how easy the image picker controller is in iOS.
- Which will probably make you see that iOS 10 now requires “purpose strings” for access to sensitive information.
- So how do you ask for access to the camera and the photo library?
- And if you’re not granted access how do you ask the user if they want to go to settings to change it?
- How do you know if the camera is even available? Some iOS devices do not have cameras.
- Something that isn’t so easy but is quite powerful is the alert controller API.
- You can use storyboards to place Sprite Kit scenes.
- Whenever you have an error, use this technique to fix it. I’m sure it’ll be fine!
- You can set all of your button’s state using Interface Builder, but it is a huge pain to keep them all up to date so I really recommend keeping a theme subclass.
- Of course, this requires using an image for some peculiar reason, so use this technique to produce an image from a color.
- I needed to be able to segue from one view controller to that same view controller. Doesn’t seem to be well supported, unfortunately, so I did it programmatically.
- Sprite Kit has its own labels, but for some reason they’re not multiline …
iOS development links: September 21st, 2016
- I wanted to use a scroll view with statically defined content from stack views and other components, but I was having a lot of trouble with warnings and errors from Interface Builder. This helped get me on the right path.
- Ever wanted to present a link within a label? While it’s a much more natural idiom for the web, TTTAttributedLabel is excellent at its job, and highly customizable.
- Here’s a helpful guide on basic tasks with submodules.
- I love this solution for enabling the “next” button on iOS when cycling through textfields.
- I had some difficulty getting a bridging header to work in my project, this guide helped me through it.
- This is a simple but effective tip for scaling a page control (or actually, any control).
- Back to basics: I searched for the most up-to-date method of splitting a string into an array with Swift, and this is what I found.
- If you want even more, Ole Begemann has a prolific guide on strings in Swift.
- I was having a lot of trouble with Swift indices and converting them to Objective-C ranges, eventually I just made everything Objective-C objects all the way down to interact with an API which required ranges.
- Supposedly, boolean values places in arrays in Swift which subsequently get bridged to Objective-C take on their Objective-C object equivalents.
- Apply local CSS to your UIWebViews.
iOS development links: September 20th, 2016
- Want to pick what storyboard your app uses at runtime? Here’s a solution.
UITextField
is highly customizable, here are some pointers on what you can change.- I did need little more, however, and here’s how you can make your text fields rounded rectangles.
- If you’re heavy handed enough with the rounded rects, you’ll need to shift the text and editing rectangles for those text fields. Here’s a way you can do that.
- I did need little more, however, and here’s how you can make your text fields rounded rectangles.
- On a couple occasions, I’ve received designs that place one view controller above another. Before iOS 8, I used to get clever by taking screenshots of the view I wanted to present over, and using that image in a
UIImageView
in the “overlay” view controller. Thankfully this is no longer necessary. - I found myself needing to respond to keyboard changes, and here’s some code from a library that I read through to acquaint myself with the API. Oddly, this library does not give you access to the frame of the keyboard.
iOS development links: September 19th, 2016
- I’ve read from the likes of NSHipster that using NSLocalizedString is a sign of a quality code, and so I thought I’d try it out. Something the documentation didn’t make obvious to me was that it must be in a specially named Strings file.
- All new code I’m writing is in Swift 3, and I found myself needing a refresher on the changes to Grand Central Dispatch. Here’s a great overview on Medium.
- In my latest project I’ve decided to forgo using Cocoapods in favor of using Git submodules. Here’s an overview of how to do this with Xcode.
- I wanted a UIButton with an image that had an “aspect fit” content mode that was reflected in Interface Builder. Here’s a discussion from StackOverflow, though ultimately I went begrudgingly with a button and image route.
- More on UIPageViewController! I wanted a UIPageControl that I placed in Interface Builder, but I couldn’t work out how to achieve that with an IB-born UIPageViewController. Thankfully I found this solution!
- Now I needed to change the color of the dots in UIPageController, and here’s how I did it.
iOS development links: September 16th, 2016
- I wanted to convert hex colors into colors, and here’s the solution I found I thought was the best.
- But now that I had hex color conversion, I needed the right place to put it for the app’s theme. What I don’t like about Swift extensions is that they don’t have names like they do in Objective-C, but Natasha the Robot has a great suggestion to do this with type aliases.
- If you’ve tried signing up for Apple Music, you know they have a really cool on boarding view with bubbles. Here’s an example implementation using SpriteKit!
- More on on boarding: https://github.com/mamaral/Onboard
- Here’s a helpful guide on using a page controller with a storyboard: https://www.appcoda.com/uipageviewcontroller-storyboard-tutorial/
- Should you use vector or raster images for your app? Here’ Bjango’s case that you shouldn’t (mostly): https://bjango.com/articles/idontusepdfs/