This tutorial will show you how to use a great piece of code that was originally written in Objective-C by ttippin84 and released on Github. I converted the code to swift and forked it over here to add the swift code.

I created a very simple example application that simulates the problem.

Screen Shot 2014-09-27 at 3.31.27 PM

When you begin editing a UITextField the code will move the control so that it is within 20 pixels of the keyboard.

Screen Shot 2014-09-27 at 3.35.03 PM

Start off by adding the ResponsiveTextFieldViewController.swift file into your project.

The code for the ViewController is very simple. All you have to do is inherit from ResponsiveTextFieldViewController instead of UIViewController and the ResponsiveTextFieldViewController class will handle everything for you. It will automatically wire up the begin and end edit actions to the code in the ResponsiveTextFieldViewController base class.

That is all there is to it.  The below code is is for your cutting and pasting pleasure or for online perusal.  You can download the full project for my sample application here: KeyboardTest2

 

 

I am new to WordPress and I have been hacking around the API in order to correct the links in my old blog posts that I imported when I moved from BlogEngine.net to WP.  In doing so, I found a lot of people questioning how to find out what their $siteid is.

As it turns out, it is quite simple to get this information.

I did it like this:

  1. Install the chrome postman extension.  It is free and allows you to make JSON requests from chrome.
  2. Enter the URL: https://public-api.wordpress.com/rest/v1/sites/www.yoursitenamehere.com
  3. Choose GET in the drop down box.
  4. Press the Send button.
  5. The results displayed will show your siteid as ID and some other information.

*Note you replace the www.yoursitenamehere.com text in step 1 with your actual fully qualified domain name.

Example of getting $siteid for a wordpress site.