Thứ Hai, 3 tháng 11, 2014

Automatically Delete Old Messages from iPhone with iOS 8+

Delete Old Messages Automatically in iOS

Messages in iOS can grow to take up considerable storage space over time, particularly for users who frequently send and receive multimedia on an iPhone. Each photo taken with an iPhone camera can easily consume 4MB, and movies will take up even more space, and it’s not unusual for an iPhone user to eventually wind up with several GB of messages and attachments. For users who don’t want to manage their own messages by deleting large messages, attached files, or old conversations, the latest iOS 8 introduces an option that will automatically delete old messages from your iPhone.


This is a great feature but do realize that this completely deletes the old messages from iOS, and they will not be available in a backup either. Thus, you’ll only want to do this if you’re absolutely certain you do not want to access and read older messages on your iPhone. Of course this feature is also available on iPad and iPod touch as well, but it’s likely to be more popular with iPhone users, thus the focus.

How to Enable Automatic Old Message Removal in iOS

By default this feature is turned OFF, which means all your messages are kept on the device until manually removed. Only change this setting if you are certain you want old messages and their media attachments to be removed automatically.

  1. Open the Settings app in iOS and head to “Messages”
  2. Scroll down in the Message settings until you see “Keep Messages” and tap on that
  3. Select the desired option: 30 Days, 1 Year, or Forever (the default)

Delete old messages automatically in iOS

If you have messages older than the time you selected, you’ll see a new screen to confirm the old message removal. At the “Delete Older Messages?” panel, confirm that you want to remove all messages and their attached photos, audio, or video, that are older than the specified date.

Confirm to delete older messages on the iPhone

Once this setting is turned on, the rest is handled automatically. As soon as a specific message and/or message attachment expiration period of 30 days or 1 year has reached it will be completely removed from the device.

It’s worth noting this is completely different from the automatic video removal feature in iOS that is turned ON by default for both audio and video messages, a feature which causes much more rapid expiration of multimedia content in the iOS Messages app. These two features can be used concurrently, however.

While this can be a good way to automatically manage outlandish Messages storage (which sometimes shows up as part of an enormously sized “Other” storage space in iTunes when an iOS device is connected), privacy buffs should also enjoy this feature, as it adds a layer of security to an iPhone or iPad by removing old conversations.

If you decide you don’t like this, you can always reverse this setting and go back to the iOS default of “Never” to stop the automatic message deletion.

Source : osxdaily[dot]com

Names and Destiny

It is a regular belief that one’s name determines his/her destiny. This belief has been around for so many years and has been proven true. Once a baby is born, the name given to that child goes a long way in influencing his/her way of life. These days, parents do a lot of research before naming their children because they would not want to contribute to the waywardness of that child. Different cultures has names that influence the destiny of a child that is why parents give their children that has good meaning in their different cultural background. Through finding out the true meaning of your name you can discover your potentials.

Hình ảnh: Chúc các chị luôn xinh đẹp và đáng yêu như em nha :* :* :* :*

 

Although Destiny is a name on its own, it means one’s fate or fortune. It is mostly given to female children but the male version of this name could be Destin, Dustin or Dustan. In most African countries, when a baby is born they are given a name in their dialect and another name in English mainly for public use. Due to the fact that one name is in their dialect it will be difficult for anyone with evil intentions to know the meaning so it is a form of protection.

In Roman countries, names are weighed equally with one’s destiny. It is only those with victorious names that were chosen to be leaders in the Roman Empire. In Europe, Runic systems are used to understand the meaning and personality attached to a name. Each Runic symbol has a special meaning and in order to understand the meaning of your name, you will convert the name to a set of runic symbol and then the personality and attributes of your name will be understood.

 

Scientists has carried out a research and discovered that children with horrible names experience bad luck, they lack self-confidence, come out with low grades and are usually faced with emotional problems. Giving your children unusual and successful names will make them successful in life.

Biblically, names carry spiritual meanings. Even the book of proverbs 22 verse 1 says that a good name is greater than all the wealth one can acquire. Make sure you choose a name not for its literal meaning but for its spiritual meaning because a child’s name goes a long way to impact his/her life.


Before choosing a name for your child, make sure you make your research to find out the meaning of the name so that you will not end up being the cause of your child’s downfall.

Thứ Sáu, 31 tháng 10, 2014

You Can Jailbreak iPhone 6 & iPhone 6 Plus on iOS 8.1 with Pangu… For Windows

Pangu Jailbreak for iOS 8.1 in Windows

The Pangu group has released a utility that will jailbreak iOS 8.1 on any iPhone or iPad device which can run the latest iOS release, including the new iPhone 6 and iPhone 6 Plus. The jailbreak is untethered and includes Cydia, but there’s a catch… at the moment the Pangu 1.1 tool runs only on Windows, though a Mac version is said to be in the works and will debut soon.

It’s important to note that while jailbreaking iOS 8.1 (or any other version of iOS 8.0) is fairly easy with the free Pangu tool, users should exercise caution and understand there are many reasons why they should not jailbreak, including a variety of risks and limitations that may occur when using unofficial third party tools to modify their devices system software. Apple also does not condone the practice, and jailbreaking an iPhone or iPad may void the devices warranty. Users considering a jailbreak should have an advantaged knowledge of iOS with a complete understanding of the risks associated with the practice, and should always perform a backup before proceeding with the process. Adequate backups allow for a user to unjailbreak the device if desired or necessary.

Compatible devices include iPhone 6, iPhone 6 Plus, iPad Air, iPad Air 2, iPad Mini Retina, iPad Mini Retina 2, iPad 3, iPad 4, or iPod touch 5th gen, running either iOS 8.0 through iOS 8.1. As already mentioned this specific version is currently for Windows only, so unless you have a Windows PC, or Windows running in Boot Camp or a virtual machine on your Mac, those with OS X only would have to sit on the sidelines until a full Mac version is released. The only other requirement is a USB cable to temporarily connect the device to the computer to complete the jailbreak.

Pangu Jailbreak iOS 8.1 compatible devices list

Those interested in the jailbreak can download and find the Pangu tool on the Pangu.io website here. The windows based utility looks easy to use and includes on-screen instructions.

iOS has gained many features natively that were long known to be accessibly exclusively to jailbreakers, ranging from things like Wi-Fi Personal Hotspot, interactive Notifications, lock screen camera access, and much more. There continues to be functionality and features that are limited to jailbroken devices, particularly relating to changes to the iOS appearance, which leads many iPhone and iPad owners to still want to jailbreak their devices.

We do not recommend jailbreaking, mostly because it can cause a device to behave erratically and crash more often, thereby potentially degrading the user experience of iOS. It’s important to know that Apple is also very opposed to jailbreaks for a variety of reasons and will not support devices that are jailbroken. Nonetheless, many advanced iPhone and iPad users wish to modify their iOS software using these tools, and those users may find the Pangu tool to be suitable for them.

Source : osxdaily[dot]com

Thứ Năm, 30 tháng 10, 2014

How to Use Handoff Between a Mac with OS X Yosemite and iOS 8.1

Handoff iOS to OS X

Handoff is a really great feature of iOS 8.1 and OS X Yosemite that allows a Mac user to pass off or resume an app session to their iPhone or iPad, or vice versa. For example, you can start typing an email on your iPhone, then pass it off to your Mac and finish writing that email or send it off. Or if you’re reading an article in Safari on your Mac and need to rush out the door, you can quickly hand it off to your iPad and read the rest on your horse as you commute to the office. There’s a lot of potential with Handoff as part of the broader Continuity experience, and it really aims to bring greater productivity to those who have an array of Apple devices.


To use Handoff, you must have the latest version of OS X and iOS on your devices, all Macs, iPhones, and iPads must be logged into the same iCloud account, the devices must be on the same Wi-Fi network, and they all must have Bluetooth 4.0 hardware that supports the feature. For some Macs that don’t officially support Handoff, this unofficial modification can make it work anyway, though some devices would require a new Bluetooth module which makes it somewhat impractical.

Enabling HandOff in iOS & OS X

To get started, you’ll want to enable the feature in both OS X and iOS, and then turn on Bluetooth and join the same Wi-Fi networks:

  1. From the Mac, go the  Apple menu > System Preferences > General and be sure that “Allow Handoff between this Mac and your iCloud devices” is enabled
  2. Enable Handoff in Mac OS X

  3. From iOS, go to the Settings app > General > Handoff & Suggested Apps > and be sure that Handoff is set to ON
  4. Enable Handoff in iOS

  5. Turn Bluetooth ON for all hardware:
    • Enable Bluetooth in iOS by swiping up to Control Center and toggling it ON
    • Enable Bluetooth in OS X by  Apple menu > System Preferences > Bluetooth and choosing “Turn Bluetooth On” (you’ll probably want to enable ‘Show Bluetooth in menu bar’ while here for ease of troubleshooting
    • Make sure both the Mac and iOS device have wi-fi enabled and are connected to the same network

That’s the basics to get Handoff enabled on a Mac and iOS (remember, the minimum requirements are the Mac running with OS X Yosemite and the iPhone / iPad running with iOS 8.1 or newer), so once you have that setup let’s trigger the feature and pass a session between two devices.

Using Handoff with iOS & OS X

Using Handoff requires that the applications support the feature, and many apps that share iOS and OS X versions do, including Safari, Mail, Pages, the iWork suite, etc. More apps will support Handoff as time goes on too.

For the example here, we’ll use Safari that is being passed from a Mac to an iPhone, but the basic idea is the same for any other supported app or device too.

  1. Have Safari on the Mac loaded with a webpage and active as the forefront application
  2. Pick up the iPhone or iPad and look at the lock screen – you should see a little Safari icon in the bottom left corner indicating Handoff is ready to pass the Macs Safari session off to the iOS device
  3. Swipe up on that icon from the corner of the lock screen to open the webpage from the Mac onto the iOS device

The Handoff icon is directly across from the Camera icon, it’s small and somewhat subtle:

Handoff icon on the lock screen of iOS

If the iPhone or iPad is already unlocked, you can find Handoff in the multitasking screen where you’d typically quit apps that you don’t want running, just swipe all the way to the left to find the Handoff option.

Handoff shown on the multitasking screen of iOS

Finally, passing a session from iOS to a Mac shows up in one of two ways: in the Command+Tab multitasking app switcher, or in the far left of the OS X Dock:

Handoff shown in the OS X Dock

This may be obvious, but the Handoff icon shown will represent the app that is active that wishes to pass off the session to the other device, meaning you’ll see the Safari icon for a Safari session, Mail icon for an email session, etc.

Triggering Handoff can be a bit tricky sometimes, we’ll touch on that in a moment.

Handoff Not Working? Handoff Unreliable? Some Troubleshooting Tips

While Handoff works flawlessly for some users, it’s very unreliable for others, and for another group of Mac and iOS users they can’t get it working at all no matter what they do. If you’re in the group having difficulties, here are a variety of troubleshooting tricks that may resolve the problems experienced with Handoff not working:

  • Make sure devices are on the same Wi-Fi network
  • Quit and relaunch the app(s) trying to use Handoff
  • Disable and re-enable Handoff (the feature is often enabled by default but doesn’t immediately work, toggling off and ON again often resolves that)
  • Disable and re-enable Bluetooth
  • Log out and back into iCloud accounts on devices
  • Reboot the Mac
  • Reboot the iPhone or iPad

Having tested Handoff considerably, I have mixed results. On one Mac it works almost all the time going in either direction (passing a session from iOS to OS X or vice versa, about 90% success rate), while on another Mac I can get it to work about 50% of the time when going from a Mac to iOS device, but only about 30% of the time going from iOS to OS X. For the latter scenario that’s obviously a pretty high failure rate, but we can almost certainly expect this great feature to become considerably better and more reliable as both iOS and OS X receive further updates and bug fixes.

Oh and for what it’s worth, there are many users who have reported that Handoff didn’t work initially, but the feature magically starts working spontaneously and seemingly out of the blue without having changed any settings. That even applies to some of the Macs that are using the unofficial Handoff enabler tool for otherwise unsupported 2011 model MacBook Air and Mac Mini computers.

What has been your experience with Handoff? Do you love it? Does it work for you? Let us know your experiences in the comments!

Source : osxdaily[dot]com

Creating a Custom Keyboard Using iOS 8 App Extension

0 Flares 0 Flares ×

Prior to iOS 8, developers could provide custom keyboards or supplement the system keyboard with custom keys within only their application. With iOS 8, Apple has made it possible to create custom keyboards that will be able to be used system wide in other apps. You can now ship a custom keyboard with your app and users will be able to choose it as the keyboard to use for every app that requires text input.

To create a successful keyboard that users are more likely to keep on using, you have to meet some of the expectations that they have for what a keyboard should do. Since they will have been using the system keyboard for a long time, it is a good place to look at when deducing what your keyboard design and functionality should be.

custom-keyboard-featured

The system keyboard is fast, responsive and capable. It doesn’t interrupt the user with requests or information. Users have come to expect the following features from their keyboard. These are not requirements for creating custom keyboards, but just examples of what you could include in your keyboard to increase the chances of it being popular in a competitive market.

  • Auto suggestion and auto correction
  • Inserting period upon double space
  • Caps lock support
  • Keycap artwork
  • Multistage input for ideographic languages
  • Appropriate layout and features based on keyboard type trait for example presenting appropriate keys for easy email input when the user switches to an email field.

Custom Keyboard Limitations

There are some system keyboard features that are unavailable to custom keyboards. These include:

  • Custom keyboards don’t have access to most of the general keyboard settings in the Settings app such as Auto-capitalization, Enable Caps Lock or dictionary reset. However you can provide your own settings bundle that can be displayed in Settings.app. You can check the Implementing an iOS Settings Bundle guide for more on this.
  • A Custom Keyboard cannot be used to type into certain text input objects. These include the secure text input objects (any object that has its secureText property set to YES) and phone pad objects (any object that has a keyboard type trait of UIKeyboardTypePhonePad or UIKeyboardTypeNamePhonePad). When the user types in any of these text input objects, the system temporarily replaces your custom keyboard with the system keyboard, and on typing in a non-secure or non-phone pad object, your keyboard resumes.
  • Input dictation isn’t possible for a custom keyboard since, like all extensions in iOS 8, it has no access to the device microphone.
  • Selecting text is also not possible. Text selection is under the control of the app that is using the keyboard.
  • Closely related to the above point, editing menu options i.e. Cut, Copy, Paste are inaccessible. If an app provides an editing menu interface, the keyboard has no access to it.
  • You cannot display key artwork above the top edge of a custom keyboard’s primary view the same way Apple does when you tap and hold a key in the top view.
  • App developers can reject the use of custom keyboards in their app. This can especially be done in apps that are sensitive to security such as banking apps.

Essential Features of Custom Keyboards

The Apple Extensions guide specifies two development essentials for every custom keyboard:

  • Trust. A custom keyboard gives you access to what a user types. You should therefore establish and maintain their trust by being visible about privacy policies. Users should be assured that their keystroke data will only be used for the document they are typing and not for other purposes not obvious to them. If the keyboard employs use of other user data such as Location Service or Address Book database, then this should be conveyed to the user.
  • Next Keyboard key.This is a mandatory feature that allows users to switch to another keyboard. On the system keyboard, this is seen as the button with a globe on it. You tap once to switch to the next keyboard and long press it to view available keyboards.

Creating the Keyboard

We are going to look at two ways to build a keyboard’s UI – programmatically and using an Interface Builder document. The method you pick is a matter of preference, but I find that if the keyboard UI is complicated, it is better to use an Interface Builder document where you’ll be able to use Auto Layout and preview the effects of the constraints you’ve added without running the app, while in the case of creating the UI in code, you’ll end up writing a lot of code to set up constraints, which you can only see the effects of by running the project. Debugging this can be a bit of a headache.

To get started, create a new iPhone Simple View Application. Name it AC Custom Keyboard. This will be the container app for the custom keyboard. All extensions must be bundled within a containing app, and the containing app must provide some functionality. Apple are strict on this and so you cannot just have a skeleton container app whose sole purpose is to distribute your extension.

Next we’ll add an extension target to the project. Click on the project in the Project Navigator then select Editor > Add Target > iOS > Application Extension > Custom Keyboard and click Next

custom_extension

On the next window, set AC Keyboard as the product name and leave the other fields as they are and click Finish. You’ll be prompted to activate the new targets’ scheme, click Cancel.

A new group will have been created on the Project Navigator with the name of your keyboard – AC Keyboard. In it is the keyboard’s view controller and a property list file. The Info.plist file contains settings for the keyboard. Notable ones are:

  • Bundle display name – This is the display name for the keyboard, change it if you want a different name to be seen by users.
  • isASCIICapable – This is a key found within the NSExtension/NSExtensionAttributes dictionary. It determines if the custom keyboard can support ASCII characters.
  • PrefersRightToLeft – Specifies the direction of the primary language of the keyboard.
  • PrimaryLanguage – The primary language of the keyboard. The default is en-US.
  • RequestsOpenAccess – Determines the network access of the keyboard.

In Main.storyboard, add a TextView to the main View. Center it so that it completely covers the view. Run the application and bring up the keyboard by tapping anywhere on the screen. To change keyboards, tap the globe button on the system keyboard. If there is no globe button, tap the button with a smiley icon. If you want to see all available keyboards, hold the globe key and a list of keyboards will appear. Our keyboard isn’t on the list. You need to first add it in Settings.

Navigate to Settings > General > Keyboard > Keyboards > Add New Keyboard and select AC Custom Keyboard. This will add it to the list of available keyboards. Go back to your app and bring up the keyboard by tapping the text view. Tap and hold the globe key and select AC Keyboard from the list that pops up.

set-custom-keyboard

On switching from the system keyboard to the custom one, you will see an almost empty keyboard with only one button for the Next Keyboard.

keyboard_default_view

To add some keys to the keyboard, open KeyboardViewController.swift and make the following changes.

In viewDidLoad() add the following at the bottom of the function right after the code for the next keyboard button.

1
2
3
4
5
6
7
8
9
10
11
let buttonTitles = ["Q", "W", "E", "R", "T", "Y"]
var buttons = createButtons(buttonTitles)
var topRow = UIView(frame: CGRectMake(0, 0, 320, 40))
       
for button in buttons {
    topRow.addSubview(button)
}
       
self.view.addSubview(topRow)
       
addConstraints(buttons, containingView: topRow)

Next add the function below which will create buttons with titles of the strings passed into it.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
func createButtons(titles: [String]) -> [UIButton] {
       
    var buttons = [UIButton]()
       
    for title in titles {
        let button = UIButton.buttonWithType(.System) as UIButton
        button.setTitle(title, forState: .Normal)
        button.setTranslatesAutoresizingMaskIntoConstraints(false)
        button.backgroundColor = UIColor(white: 1.0, alpha: 1.0)
        button.setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
        button.addTarget(self, action: "keyPressed:", forControlEvents: .TouchUpInside)
        buttons.append(button)
    }
       
    return buttons
}

This function iterates through an array of Strings and creates buttons with the respective titles. It also adds a target to each button so that when it is tapped, the function keyPressed() will be called. Next add this function.

1
2
3
4
5
func keyPressed(sender: AnyObject?) {
    let button = sender as UIButton
    let title = button.titleForState(.Normal)
    (textDocumentProxy as UIKeyInput).insertText(title!)
}

Here you get the title of the tapped button and insert it at the insertion point of the current text input object via the textDocumentProperty. This is an object conforming to the UITextDocumentProxy protocol, which acts as a proxy between the keyboard and the text input object that summoned it.

Next we add the addConstraints() method which will add constraints to the buttons and the containingView.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
func addConstraints(buttons: [UIButton], containingView: UIView){
       
        for (index, button) in enumerate(buttons) {
           
            var topConstraint = NSLayoutConstraint(item: button, attribute: .Top, relatedBy: .Equal, toItem: containingView, attribute: .Top, multiplier: 1.0, constant: 1)
           
            var bottomConstraint = NSLayoutConstraint(item: button, attribute: .Bottom, relatedBy: .Equal, toItem: containingView, attribute: .Bottom, multiplier: 1.0, constant: -1)
           
            var leftConstraint : NSLayoutConstraint!
           
            if index == 0 {
               
                leftConstraint = NSLayoutConstraint(item: button, attribute: .Left, relatedBy: .Equal, toItem: containingView, attribute: .Left, multiplier: 1.0, constant: 1)
               
            }else{
               
                leftConstraint = NSLayoutConstraint(item: button, attribute: .Left, relatedBy: .Equal, toItem: buttons[index-1], attribute: .Right, multiplier: 1.0, constant: 1)
               
                var widthConstraint = NSLayoutConstraint(item: buttons[0], attribute: .Width, relatedBy: .Equal, toItem: button, attribute: .Width, multiplier: 1.0, constant: 0)
               
                containingView.addConstraint(widthConstraint)
            }
           
            var rightConstraint : NSLayoutConstraint!
           
            if index == buttons.count - 1 {
               
                rightConstraint = NSLayoutConstraint(item: button, attribute: .Right, relatedBy: .Equal, toItem: containingView, attribute: .Right, multiplier: 1.0, constant: -1)
               
            }else{
               
                rightConstraint = NSLayoutConstraint(item: button, attribute: .Right, relatedBy: .Equal, toItem: buttons[index+1], attribute: .Left, multiplier: 1.0, constant: -1)
            }
           
            containingView.addConstraints([topConstraint, bottomConstraint, rightConstraint, leftConstraint])
        }
    }

Run the app and you should see a similar keyboard as shown below

programmatic_ui

As you can see, adding views programmatically requires you to set up constraints in code and if your keyboard’s UI is complicated and has many keys, this can get complicated and hard to debug. Next we will look at using the Interface Builder to create buttons.

Create a nib file by navigating to File > New > File > iOS > User Interface > View. Name it KeyboardView and make sure it is under the AC Keyboard target.

Select the nib’s view and in the Attributes Inspector, set its Size as Freeform and Status Bar to None. Then go to the Size Inspector and set its width to 320 and height to 220.

In KeyboardViewController.swift add the following in viewDidLoad() after the call to super.viewDidLoad(). This sets the nib file as the view of the view controller.

1
2
3
let nib = UINib(nibName: "KeyboardView", bundle: nil)
let objects = nib.instantiateWithOwner(self, options: nil)
view = objects[0] as UIView;

Add a view to the nib’s main view. Click on the Pin menu at the bottom of the Interface Builder interface and give it the following constraints – Height of 40, Trailing space of 0, Leading space of 0 and Top space to container of 42. Make sure Constrain to margin is not checked.

add_constraints

Add 9 buttons to the view. Set their text color to Dark Gray and change their titles to these letters respectively: ‘A’, ‘S’, ‘D’, ‘F’, ‘G’, ‘H’, ‘J’, ‘K’, ‘L’. Now for the constraints.

With each button, select the Align menu and select Vertical Center in Container.

alignment auto layout

Select the A button and add a Leading space to Superview fo 5. Select L and add a Leading space to Superview of 5. Control-drag from A to S and select Horizontal Spacing. We’ll change its value later. Do the same with S to D, D to F, F to G, and so on.

Select A and in the Size Inspector, make sure that its Leading Space to S ie set to a constant of 5. Select the next letter and set its Trailing space to the letter following it to 5. When you are done, all letters should have a Leading Space and Trailing space set to 5. Select the main view then Editor > Resolve Auto Layout Issues > All Views > Update Frames.

Run the application and you should see the keys you just added set up below the ones you added in code.

interface_builder_ui

To create outlets and actions for the keys, select the File’s Owner from the Document Outline, then in the Identity Inspector, set the class as KeyboardViewController. You can then create actions and outlets like you usually do in storyboard files by Control-dragging from a control to the view controller class. (You’ll see more of this in the example that follows).

Now that we have seen how to create a keyboard’s UI programmatically and with a nib file, let us add some functionality to it. For this, I have a starter project that we will be using. The project is a of a simple keyboard that we will add some functionality to. It is shown below. You should note that to keep it simple, I didn’t design for all size classes so, while it looks nice on the iPhone 5S, it doesn’t look quite the same for bigger screens. You can download the code here. Also note that the keyboard’s name is Appcoda Keyboard and not the AC Keyboard we had earlier.

keyboard_starter

I have already set up the actions and outlets we’ll require, but haven’t written the code for them (except for the Next Keyboard key).

First, you’ll notice that the Next Keyboard key has been replaced with a key titled KB. The action method for this can be seen it the view controller file as shown below.

1
2
3
    @IBAction func nextKeyboardPressed(button: UIButton) {
        advanceToNextInputMode()
    }

We are first going to set up the actions for keys with letters and symbols i.e. any key you tap and see its title as the typed text. I created an action method for all these keys called keyPressed(). Modify this method as shown.

1
2
3
4
    @IBAction func keyPressed(button: UIButton) {
        var string = button.titleLabel!.text
        (textDocumentProxy as UIKeyInput).insertText("\(string!)")
    }

This is similar to what we had before. The title of the button is inserted at the insertion point of the current text input object via the textDocumentProperty. All the letters we type will be in Caps, but we will fix this shortly. Next modify the following functions to set up actions for the backspace(BS), space(SPACE) and return(RTN) keys respectively.

1
2
3
4
5
6
7
8
9
10
11
    @IBAction func backSpacePressed(button: UIButton) {
        (textDocumentProxy as UIKeyInput).deleteBackward()
    }
   
    @IBAction func spacePressed(button: UIButton) {
        (textDocumentProxy as UIKeyInput).insertText(" ")
    }
   
    @IBAction func returnPressed(button: UIButton) {
        (textDocumentProxy as UIKeyInput).insertText("\n")
    }

Run the app and test the keys.

In the view file, you will notice two views labelled Char Set 1 and Char Set 2. These are on the same row with one on top of the other. In viewDidLoad() the second view is hidden. Modify the charSetPressed() function as shown so that when the user presses the key labelled 1/2, the key’s text will change to 2/2 and a new set of characters will appear on the first row of the keyboard.

1
2
3
4
5
6
7
8
9
10
11
    @IBAction func charSetPressed(button: UIButton) {
        if button.titleLabel!.text == "1/2" {
            charSet1.hidden = true
            charSet2.hidden = false
            button.setTitle("2/2", forState: .Normal)
        } else if button.titleLabel!.text == "2/2" {
            charSet1.hidden = false
            charSet2.hidden = true
            button.setTitle("1/2", forState: .Normal)
        }
    }

charset
If you look at the system keyboard, there is usually an indication, in the form of a brief animation when you tap a key. We should add some sort of feedback so the user knows that they tapped the right key. Add the following at the end of the keyPressed() method.

1
2
3
4
5
6
    UIView.animateWithDuration(0.2, animations: {
            button.transform = CGAffineTransformScale(CGAffineTransformIdentity, 2.0, 2.0)
            }, completion: {(_) -> Void in
                button.transform =
                    CGAffineTransformScale(CGAffineTransformIdentity, 1, 1)
        })

This makes a key scale up briefly when tapped before going back to its original size.

Lastly we’ll implement the Capslock key(CL). Modify the capsLockPressed() function as follows.

1
2
3
4
5
6
7
8
    @IBAction func capsLockPressed(button: UIButton) {
        capsLockOn = !capsLockOn
       
        changeCaps(row1)
        changeCaps(row2)
        changeCaps(row3)
        changeCaps(row4)
    }

Notice that at the beginning of the file, we set capsLockOn to true. The above method toggles this value to be true/false and then calls a function that will change the case of the typed text as well as the title of the buttons. Add the following method to the class.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
    func changeCaps(containerView: UIView) {
        for view in containerView.subviews {
            if let button = view as? UIButton {
                let buttonTitle = button.titleLabel!.text
                if capsLockOn {
                    let text = buttonTitle!.uppercaseString
                    button.setTitle("\(text)", forState: .Normal)
                } else {
                    let text = buttonTitle!.lowercaseString
                    button.setTitle("\(text)", forState: .Normal)
                }
            }
        }
    }

Run the app and you should be able to change the case of the letters.

custom keyboard - capslock

Conclusion

This tutorial doesn’t cover all that you can do with the keyboard extension. There is still a lot you can do to make the keyboard better. You can have it detect the beginning of sentences so that the first letter of the next typed word is capitalized, you can add auto-correction, auto-completion e.t.c. This is a new technology on the Apple platform, and it will be interesting to see what developers come up with.

For your reference, you can download the Xcode project here.

Source : appcoda[dot]com

Thứ Tư, 29 tháng 10, 2014

How to Hide Photos on iPhone & iPad with the iOS Hidden Album

How to hide pictures in iOS

Everyone likely has a few photos sitting on their iPhone they’d rather nobody else see, whether it’s embarrassing selfies, poorly filtered or edited pics, a picture of a receipt or personal paperwork, or anything else in the realm of private photos. Those pictures can make showing someone another picture on your iPhone (or iPad) an awkward experience, as you’re hoping they don’t start flipping through your Camera Roll to discover that terrible photo of you after winning the pie eating contest. Fortunately the newest versions of iOS include a new way to mitigate that potential awkwardness by hiding select photos.

The photo hiding feature must be enabled individually for each picture, as it’s set on a per-image basis. At the moment there is no bulk hide function like there is with the ability to bulk remove a bunch of photos all at once, so you may want to get in the habit of regularly hiding the pictures you don’t want to show up in your general photos app views.

Note this feature is available only to iOS 8 and newer, and though we’re going to focus on the iPhone here, it works the same on the iPad and iPod touch too.

Hiding a Photo in iOS

  1. Open Photos and go to Camera Roll or Albums as usual
  2. Tap on the picture you wish to hide, this will open it as usual
  3. Tap and hold on the photo itself to bring up an action menu, choose “Hide”
  4. Confirm that you want to hide the picture by tapping “Hide Photo”

Hide photos in iOS

Now that a picture or many are hidden, they’ll become invisible to the Collections, Years views, and instead are placed in a separate “Hidden” album.

Accessing Your Hidden Photos in iOS

  1. Open the Photos app and tap on “Albums” view
  2. Locate in the list of Albums the folder called “Hidden” (note the thumbnail is not automatically generated for that folder, offering additional privacy)
  3. Find your hidden photos in the Hidden Album

This is where all of your hidden photos will be stored.

Hidden photos in iOS Albums

Note that while a picture is hidden, it can still be shared or sent through messages as usual, as long as you access it from this hidden album.

Unhiding a Picture in iOS

  1. From the Hidden photo album, tap on the picture you want to unhide
  2. Tap and hold on the picture and choose “Unhide” from the submenu that pops up

Unhide photos in iOS
This sends the picture back to the general Camera Roll and it becomes accessible to all albums and collections views again.

Is the Photo Really Hidden on the iPhone? Kind Of

It’s important to understand how the hide photo function works: the photo(s) are hidden from the camera roll, Moments, Collections, and Year view, but are still visible in a photo album not-so-discretely called “Hidden”. In other words, while this is very effective at hiding photos from casual iPhone use and from flipping through your pictures in iOS, anyone who knows to look for the ‘Hidden’ album can still view the hidden images.

This is a decent way of handling your truly private pictures, but if you’re concerned about someone discovering the Hidden photos album, consider using the send-to-self trick to avoid offering photo album and camera roll access, or maybe just message them the pictures instead.

Enjoy this? Don’t miss our tons of other Photos app tips.

Source : osxdaily[dot]com

Thứ Ba, 28 tháng 10, 2014

Set Up Apple Pay on iPhone

Apple Pay

Apple Pay is a contactless payment platform that is newly available to iPhone 6 users. It works well and is incredibly simple; once you’ve added a card to Apple Pay, you just need to wave your iPhone over an Apple Pay compatible NFC payment terminal to pay for whatever you’re buying. The iPhones built-in TouchID sensor serves as an ID mechanism to prevent unauthorized usage, and you never need to pull out a credit or debit card after its configured. And yes, it really works that well once you have it setup, and that’s what we’re going to cover here.

To use Apple Pay, you’ll need at least iOS 8.1 on a new iPhone 6 or iPhone 6 Plus (the newest iPhone models have NFC payment chips, older models do not), and an Apple Pay compatible credit or debit card. Note that you only need the card once for setup purposes, after that you can leave it behind. Supported cards vary but Apple is maintaining a list of banks and bankcards that support the feature here, the list below is current as of now but is sure to change as more banks add additional card support.

Apple Pay compatible cards at the moment

Oh and if you have a Wells Fargo credit card, they’ll even give you $20 to try out Apple Pay, or $10 if you only have a Wells Fargo debit card. Free money is great, right?

Adding a Card to Apple Pay on Your iPhone

Got a compatible credit or debit card, iOS 8.1, and a new iPhone? You’re good to go, the rest is a piece of cake:

  1. Open the Passbook app and tap on “Set Up Apple Pay”
  2. Choose “Add a new Credit or Debit Card”
  3. Set up Apple Pay on the iPhone

  4. Don’t fill anything out, you can do it automatically with your iPhone Camera! Get out your credit/debit card and place it in reasonably bright lighting, then click on the Camera icon next to “Card Number” and line everything up, give it a moment to recognize the card and be sure all details are correct
  5. Autofill the Apple Pay credit card details with camera

  6. Agree to the Terms and Conditions, then go through the verification process to enable Apple Pay for the card – some cards make you call a number to verify, others have an app to verify

The setup is really quite simple, if you feel like it you can go through the process again to add another card or several cards to Apple Pay. At the moment there appears to be an 8 card limit, so plastic jugglers may need to prioritize which cards they want to add to their iPhone. Each card gets added to Passbook and you can toggle between them during payment if you want to use one rewards card over another.

Making a Payment with Apple Pay

So how about the payment side of things? Paying with Apple Pay is a piece of cake after you have it setup properly. When it comes time to checkout, hover your iPhone over the NFC payment terminal, the iPhone will get a little alert indicating a payment is ready, then you just put your finger on Touch ID to complete the checkout. That’s it. No signing anything, no swiping anything, no handing over a piece of plastic.

Using Apple Pay with an iPhone and NFC Terminal

Support for Apple Pay is still rolling out across retailers, stores, and restaurants, but something like 200,000 stores currently support it already, and that number is likely to grow more rather quickly. Much like the supported cards list, Apple is also maintaining a list of stores that allow usage of Apple Pay, at the moment it includes everything from Whole Foods, McDonalds, Macy’s, Bloomingdales, Nike, Texaco, Walgreens, Subway, Petco, Office Depot, Chevron, Toys R Us, the Apple Store, and quite a few more.

Apple Pay Retailers List

Though Apple Pay is officially supported in the USA at the moment, multiple reports have indicated that Apple Pay is usable right now outside of the USA in a variety of countries, including the UK, Australia, UAE, and Canada, if the card is issued with US credentials.

If you have a compatible card and a new iPhone, take the time to set up Apple Pay, it’s pretty nifty and feels a bit like the future. And speaking of the future, soon you’ll be able to use the Apple Watch for making payments this way too.

Source : osxdaily[dot]com