Showing posts with label iOS. Show all posts
Showing posts with label iOS. Show all posts

Saturday, May 16, 2020

iOS Edit Menu

I use the three finger double tap accessibility gesture to put my iPhone in zoom mode, handy for reading fine print and drawing tiny pictures. You then use three fingers to pan the zoomed view around the screen.

But recently I discovered that if you're not zoomed in, there are three finger gestures that do other things.

  • swipe left: undo
  • swipe right: redo
  • tap shows an Edit menu of undo/redo, cut/copy/paste

The best thing about this is that note I can turn off Shake to Undo, which I'm constantly having to cancel while grocery shopping. Problem solved!

Plus, iOS text editing isn't great about offering the Paste function when you drag the cursor to a new location. When that happens, just three-finger-tap and then choose Paste from the menu. Another problem solved!

Monday, June 20, 2016

Old code, new Xcode

When you download some old code from the Interwebs with such like:

[self.window addSubview:self.viewController.view];

and it runs just fine... and later you update Xcode and start getting runtime errors:

Applications are expected to have a root view controller at the end of application launch

Fortunately the fix is easy:

[self.window setRootViewController:self.viewController];

Thanks, Interwebs!!

Friday, January 01, 2016

Swift selector argument - yes you can!

Selectors are an Objective C thing, but sometimes you have to use them in Swift.

For example, if you are calling performSelectorOnMainThread to work around the problem between GCD and UIWebView that causes hangs in stringByEvaluatingJavaScriptFromString (see here) you don't have a choice.

But how to pass an argument? I defined my selector function to take AnyObject? just as I assumed I should since withObject:AnyObject?

So tl;dr - here's what I was doing wrong. The colon at the end of the selector DOES MATTER. Well duh, of course it does, because it indicates there's an argument. Here's an example of everything working correctly...

  private func caller() {
    let arg = 42
    performSelectorOnMainThread("myfunc:", withObject: arg, waitUntilDone: false)
  }

  func myfunc(arg: AnyObject?) {
    guard let n = arg as? Int else {
      print("how did we get in this cornfield?")
      return
    }
    print("and here we are with our arg n: \(n)")
  }

...and the proof of the pudding - my, how tasty!

and here we are with our arg n: 42

I hope this saves somebody else a few hours of struggle!

Sunday, November 15, 2015

Hard-to-read Podcasts

If you use the iOS Podcasts app, you've probably had occasion to swear at the producers of a podcast for their graphics and how they translate into dark text on a dark background. It's even worse in low light.


Well swear no more! At least not about this. It turns out there's a setting for that! Unfortunately, because this is iOS, you have to open the Settings app. Go there and choose Podcasts. And there aren't that many settings, so find this one, Custom Colors, and turn it off


And enjoy more podcasts!