Xcode6 automatically prompts that the image ksimagenamed supports the custom uiimagenamed (name) and uiimageload (name, type) methods.

Source: Internet
Author: User
Tags spritekit

Ksimagenamed is a plug-in that enables xcode to preview images in projects.Code [nsimage imagenamed:. xcode automatically lists the images in the project and provides the preview function.

The Project address is https://github.com/ksuther/KSImageNamed-Xcode.


However, in projects, users often use macro definitions such as uiimagenamed (nsstring * name) and uiimageload (name, type). I prefer to use these macro definition files, can we automatically prompt when writing the code uiimagenamed (if not, I will not write this article)? Well, let's see how I did it:

You may also notice that the keyword file configured in this project is completions. plist. The Code is as follows:

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><array>    <dict>        <key>classAndMethod</key>        <string>mage imageNamed:</string>        <key>methodDeclaration</key>        <string> imageNamed:</string>        <key>methodName</key>        <string>imageNamed</string>        <key>comment</key>        <string>Standard NSImage/UIImage method</string>    </dict>    <dict>        <key>classAndMethod</key>        <string>prite spriteWithFile:</string>        <key>methodDeclaration</key>        <string> spriteWithFile:</string>        <key>methodName</key>        <string>spriteWithFile</string>        <key>comment</key>        <string>cocos2d's CCSprite</string>    </dict>    <dict>        <key>classAndMethod</key>        <string>priteFrame frameWithImageNamed:</string>        <key>methodDeclaration</key>        <string> frameWithImageNamed:</string>        <key>methodName</key>        <string>frameWithImageNamed</string>        <key>comment</key>        <string>cocos2d's CCSpriteFrame</string>    </dict>    <dict>        <key>classAndMethod</key>        <string>ode spriteNodeWithImageNamed:</string>        <key>methodDeclaration</key>        <string> spriteNodeWithImageNamed:</string>        <key>methodName</key>        <string>spriteNodeWithImageNamed</string>        <key>comment</key>        <string>SpriteKit's sprite node</string>    </dict>    <dict>        <key>classAndMethod</key>        <string>ure textureWithImageNamed:</string>        <key>methodDeclaration</key>        <string> textureWithImageNamed:</string>        <key>methodName</key>        <string>textureWithImageNamed</string>        <key>comment</key>        <string>SpriteKit's SKTexture</string>    </dict></array></plist>

Before </array>, add

 

<dict>        <key>classAndMethod</key>        <string>UIImageNamed(</string>        <key>methodDeclaration</key>        <string>(</string>        <key>methodName</key>        <string>UIImageNamed</string>        <key>comment</key>        <string>Custom UIImageName method</string>    </dict>    <dict>        <key>classAndMethod</key>        <string>UIImageLoad(</string>        <key>methodDeclaration</key>        <string>(</string>        <key>methodName</key>        <string>UIImageLoad</string>        <key>comment</key>        <string>Custom UIImageLoad method</string>    </dict>

Save, run the project, and restart xcode. Now we can customize the method. If you use another macro definition, you can add configuration information according to this method.

Xcode6 automatically prompts that the image ksimagenamed supports the custom uiimagenamed (name) and uiimageload (name, type) methods.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.