Tuesday, June 28, 2016

Mac Technique: Select Emoji with hotkey

How to type the "Dog Face" with a Mac?

Just select [control] + [command] + [space] in a text field.

Then select the Emoji as below:


Monday, June 20, 2016

Mac Technique: Search for File Types in Finder

To search for a certain file type in Finder, type:

kinds:fileType

and then select the desired file type displayed below the search text.

Examples:


kind:rtf


kind:movie


Reference:

How to Search & Find Specific File Types & File Formats in Mac OS X

Tuesday, June 7, 2016

Select the iOS device or bluetooth audio output with action sheet

While playing a sound file with AVAudioPlayer, the following code may be used to select the audio output between the speaker of an iPhone/iPad or the bluetooth headset in an action sheet:


let buttonOutput = UIButton(frame: CGRectMake(0, 0, 200, 30))
buttonOutput.center = CGPointMake(view.center.x, view.center.y+200)
buttonOutput.setTitle("Output", forState: UIControlState.Normal)
buttonOutput.setTitleColor(UIColor.blueColor(), forState: UIControlState.Normal)
buttonOutput.setTitleColor(UIColor.cyanColor(), forState: UIControlState.Highlighted)
buttonOutput.addTarget(self, action: #selector(buttonOutputPressed), forControlEvents: UIControlEvents.TouchUpInside)

view.addSubview(buttonOutput)

and

func buttonOutputPressed() {
        
    let model = UIDevice.currentDevice().model
        
    let session = AVAudioSession()
        
    let controller = UIAlertController(title: "Select Output", message: "", preferredStyle: UIAlertControllerStyle.ActionSheet)
        controller.addAction(UIAlertAction(title: model, style: UIAlertActionStyle.Default, handler: { action in
    do {
        try session.setCategory(AVAudioSessionCategoryPlayAndRecord, withOptions: AVAudioSessionCategoryOptions.DefaultToSpeaker)
    } catch {
        print("AVAudioSession error!")
    }
    }))
    controller.addAction(UIAlertAction(title: "Bluetooth", style: UIAlertActionStyle.Default, handler: { action in
    do {
        try session.setCategory(AVAudioSessionCategoryPlayAndRecord, withOptions: AVAudioSessionCategoryOptions.AllowBluetooth)
    } catch {
        print("AVAudioSession error!")
    }
    }))
    presentViewController(controller, animated: true, completion: nil)
}

Result:



Monday, June 6, 2016

Mac Technique: Copy the path of a file in Finder

To get the path of a file in Finder, just click the right mouse button on the file, and then press the alt/optoin key. The option Copy "Filename" is changed to Copy "Filename" as Pathname. Simply select it. Then paste the copied path to the place you like, such as the terminal.


Sunday, June 5, 2016

Mac Technique: Display iPhone screen on Mac with QuickTime

Displaying the screen of an iPhone on a Mac is very easy!! Just use QuickTime Player.


Select File -> New Movie Recording


Select the down arrow at the right of the red record button. Then select the iPhone.


The screen of the iPhone is then displayed on Mac's screen.