让自己的应用在其他应用中打开列表中显示

目的:

让其他应用程序 , 查看文件时候, 弹出选择项目, 其中包含自己应用的打开方式


本应用需要设置的内容TARGETS -->Info--->Document types


名称( ALL Files)自己定义.


支持类型文件:

public.data(打开大多数文件[文件夹除外]的开发方式列表都显示,自己的应用   例如:     .db,   .dat , 包含public.content的全部)

public.content(打开一些简单文件时候,打开方式列表显示自己应用,例如:  png,jpg,plist,文档,表格,html等)


指定支持类型:(图片为例)

按文件类型“JPEG”
由文件扩展名“。JPG”
由文件扩展名“。JPEG”
由mime类型“image / jpeg文件”
“public.jpeg”, 或者是public.image


其他类型,参照最后的文档,自己尝试修改




本应用还需要在 AppDelegate实现方法:

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation

{

/*外部文件访问本应用,会传递参数过来*/ 

    NSLog(@"application = %@",application);

    NSLog(@"url = %@",url);

    NSLog(@"sourceApplication = %@",sourceApplication);

    NSLog(@"annotation = %@",annotation);

}

打印结果:

//文件路径

url = file://localhost/private/var/mobile/Applications/10A6BAB7-A427-4DE5-9A67-142AD74956EC/Documents/Inbox/1.jpeg

//来源的 Bundle identifier

sourceApplication = com.lazerwalker.MWOpenInKitDemo



其余两个参数根据自己需求处理


PS:有可能你的这个应用已经安装到机器, 但是再别的应用查看文件时候的打开方式列表没有自己的应用

1.从新运行一次本应用

2.从新打开其他应用


转载请标明出处,喜欢请点赞吐舌头



支持类型参考文档UTI:   (谷歌翻译之后就知道大概意思了)

UTI文件类型

Description文件类型描述

Conforms to 嘿嘿,咱们需要的支持类型字段


About Uniform Type Identifiers

Uniform Type Identifiers were introduced by Apple in Mac OS 10.4 (Tiger) as a modern replacement to traditional means for identifying the type of data contained within byte streams such as disk files and the clipboard.

On the Macintosh, 4-character codes known as file types have been used traditionally for this purpose, while filename extensions were (and are still) used on platforms such as Windows and Unix. In adittion to file types and filename extensions, the Internet has introduced mime types for identifying streams of data delivered through the network.

For example, let's have a look at the different ways for identifying a JPEG image:

  • by the file type 'JPEG'
  • by the filename extension ".jpg"
  • by the filename extension ".jpeg"
  • by the mime type "image/jpeg"

With UTIs, all these different identification methods are replaced by a single string: "public.jpeg".

UTIs are plain strings, commonly formed in reverse-DNS notation. Some examples are:

  • public.html
  • com.adobe.pdf
  • com.compuserve.gif
  • public.folder
  • com.microsoft.word.doc

UTIs also provide a mechanism for the classification of data types. For example, the "public.jpeg" UTI conforms to the "public.image" UTI. This mechanism can be used by applications on Mac OS X for specifying classes of accepted data types in cases such as the file selection dialogs, the pasteboard, and drag and drop.

The QDrop plug-in area fully supports this classification mechanism. For example, suppose that a QDrop plug-in area has to be configured to accept drops of image files. Instead of specifying a list of all image UTIs ("public.jpeg", "public.tiff", and so on), the "public.image" UTI can be used and the plug-in area will accept any data type that conforms to the "public.image" UTI.

The tables bellow list the majority of the UTIs defined by Mac OS 10.5 (Leopard). Note that this list is not exhastive, and that third party applications may define UTIs for their own private use and data formats. For example, 4Dv11 SQL defines "com.4d.private.text.native" and a few others for use with its pasteboard related commands.

Abstract base types

UTIDescriptionConforms to
public.item generic base type for most things (files, directories)  
public.content base type for anything containing user-viewable document content (documents, pasteboard data, and document packages)  
public.composite-content base type for content formats supporting mixed embedded content (i.e., compound documents) public.content
com.apple.application base type for Mac OS X applications, launchable items  
public.message base type for messages (email, IM, etc.)  
public.contact contact information, e.g. for a person, group, organization  
public.archive an archive of files and directories  
public.disk-image a data item mountable as a volume public.archive

Concrete base types

UTIDescriptionConforms to
public.data base type for any sort of simple byte stream, including files and in-memory data public.item
public.directory file system directory (includes packages AND folders) public.item
com.apple.resolvable anything the Alias Manager can resolve  
public.symlink a symbolic link public.item, com.apple.resolvable
com.apple.mount-point a volume mount point (resolvable, resolves to the root dir of a volume) public.item, com.apple.resolvable
com.apple.alias-file a fully-formed alias file public.data, com.apple.resolvable
public.url The bytes of a URL public.data
public.file-url The text of a "file:" URL public.url

Text types

UTIDescriptionConforms to
public.text base type for all text-encoded data, including text with markup (HTML, RTF, etc.) public.data, public.content
public.plain-text text with no markup, unspecified encoding public.text
public.utf8-plain-text plain text, UTF-8 encoding public.plain-text
public.utf16-external-plain-text plain text, UTF-16 encoding, with BOM, or if BOM is not present, has "external representation" byte order (big-endian) public.plain-text
public.utf16-plain-text plain text, UTF-16 encoding, native byte order, no BOM public.plain-text
public.rtf Rich Text Format public.text
public.html HTML, any version public.text
public.xml generic XML public.text
public.xhtml XHTML public.xml

Composite content types

UTIDescriptionConforms to
com.adobe.pdf Adobe PDF public.data, public.composite-content
com.apple.rtfd Rich Text Format Directory (RTF with content embedding, on-disk format) com.apple.package, public.composite-content
com.apple.flat-rtfd Flattened RTFD (pasteboard format) public.data, public.composite-content
com.apple.webarchive The WebKit webarchive format public.data, public.composite-content
com.adobe.postscript PostScript public.data, public.composite-content
com.adobe.encapsulated-postscript Encapsulated PostScript com.adobe.postscript
public.presentation presentation public.composite-content

Image content types

UTIDescriptionConforms to
public.image abstract image data public.data, public.content
public.jpeg JPEG image public.image
public.jpeg-2000 JPEG-2000 image public.image
public.tiff TIFF image public.image
com.apple.pict Quickdraw PICT format public.image
com.compuserve.gif GIF image public.image
public.png PNG image public.image
com.apple.quicktime-image QuickTime image format public.image
com.apple.icns Apple icon data public.image
com.microsoft.bmp Windows bitmap public.image
com.microsoft.ico Windows icon data public.image
public.fax fax public.image, public.message
com.apple.macpaint-image MacPaint image public.image
public.svg-image scalable vector graphics (SVG) public.image
public.xbitmap-image X bitmap image public.image
public.camera-raw-image camera raw image public.image
com.adobe.photoshop-image Adobe Photoshop document public.image
com.adobe.illustrator.ai-image Adobe Illustrator document public.image
com.truevision.tga-image TGA image public.image
com.sgi.sgi-image Silicon Graphics image public.image
com.ilm.openexr-image OpenEXR image public.image
com.kodak.flashpix-image FlashPix image public.image
com.adobe.raw-image Adobe raw image public.camera-raw-image
com.canon.crw-raw-image Canon CRW raw image public.camera-raw-image
com.canon.cr2-raw-image Canon CR2 raw image public.camera-raw-image
com.canon.tif-raw-image Canon TIF raw image public.camera-raw-image
com.nikon.raw-image Nikon raw image public.camera-raw-image
com.olympus.raw-image Olympus raw image public.camera-raw-image
com.fuji.raw-image Fuji raw image public.camera-raw-image
com.sony.raw-image Sony raw image public.camera-raw-image
com.sony.arw-raw-image Sony ARW raw image public.camera-raw-image
com.konicaminolta.raw-image Minolta raw image public.camera-raw-image
com.kodak.raw-image Kodak raw image public.camera-raw-image
com.panasonic.raw-image Panasonic raw image public.camera-raw-image
com.pentax.raw-image Pentax raw image public.camera-raw-image
com.leafamerica.raw-image Leaf raw image public.camera-raw-image
com.leica.raw-image Leica raw image public.camera-raw-image
com.hasselblad.fff-raw-image Hasselblad FFF raw image public.camera-raw-image
com.hasselblad.3fr-raw-image Hasselblad 3FR raw image public.camera-raw-image

Audiovisual content types

UTIDescriptionConforms to
public.audiovisual-content audio and/or video content public.data, public.content
public.movie A media format which may contain both video and audio. Corresponds to what users would label a "movie". public.audiovisual-content
public.video pure video (no audio) public.movie
public.audio pure audio (no video) public.audiovisual-content
com.apple.quicktime-movie QuickTime movie public.movie
public.mpeg MPEG-1 or MPEG-2 movie public.movie
public.mpeg-4 MPEG-4 movie public.movie
public.mp3 MP3 audio public.audio
public.mpeg-4-audio MPEG-4 audio layer (.m4a) public.mpeg-4, public.audio
com.apple.protected-mpeg-4-audio Apple protected MPEG4 format (.m4p, iTunes music store format) public.audio
public.mpeg-2-video MPEG-2 video public.video
com.apple.protected-mpeg-4-video protected MPEG-4 movie public.movie
public.dv-movie DV movie public.movie
public.avi AVI movie public.movie
public.3gpp 3GPP movie public.movie
public.3gpp2 3GPP2 movie public.movie
com.microsoft.windows-media-wm Windows media public.movie, com.microsoft.advanced-systems-format
com.microsoft.windows-media-wmv Windows media public.movie, com.microsoft.advanced-systems-format
com.microsoft.windows-media-wmp Windows media public.movie, com.microsoft.advanced-systems-format
com.microsoft.windows-media-wma Windows media audio public.audio, com.microsoft.advanced-systems-format
com.real.realmedia RealMedia public.movie
com.real.realaudio RealMedia audio public.audio
public.ulaw-audio uLaw audio public.audio
public.au-audio AU audio public.audio
public.aifc-audio AIFF-C audio public.audio
public.aiff-audio AIFF audio public.aifc-audio
public.midi-audio MIDI audio public.audio
public.downloadable-sound downloadable sound public.audio
com.apple.coreaudio-format Apple CoreAudio format public.audio
public.ac3-audio AC-3 audio public.audio
com.digidesign.sd2-audio Sound Designer II audio public.audio
com.microsoft.waveform-audio Waveform audio public.audio
com.soundblaster.soundfont SoundFont audio public.audio

Directory types

UTIDescriptionConforms to
public.folder a user-browsable directory (i.e., not a package) public.directory
public.volume the root folder of a volume/mount point public.folder
com.apple.package a packaged directory public.directory
com.apple.bundle a directory conforming to one of the CFBundle layouts public.directory

Application types

UTIDescriptionConforms to
com.apple.application-bundle a bundled application com.apple.application, com.apple.bundle, com.apple.package
com.apple.application-file a single-file Carbon/Classic application com.apple.application, public.data

Contact types

UTIDescriptionConforms to
public.vcard VCard format public.data, public.contact

Archive types

UTIDescriptionConforms to
org.gnu.gnu-tar-archive GNU tar archive public.data, public.archive
public.tar-archive tar archive org.gnu.gnu-tar-archive
org.gnu.gnu-zip-archive GZip archive public.data, public.archive
org.gnu.gnu-zip-tar-archive gzip tar archive org.gnu.gnu-zip-archive
public.bzip2-archive Bzip2 archive public.data, public.archive
public.tar-bzip2-archive Bzip2 compressed tar archive public.bzip2-archive
com.apple.binhex-archive BinHex archive public.data, public.archive
com.apple.macbinary-archive MacBinary archive public.data, public.archive
com.allume.stuffit-archive Stuffit archive public.data, public.archive
public.zip-archive Zip archive com.pkware.zip-archive
com.pkware.zip-archive PKZip archive public.zip-archive

MS Office types

UTIDescriptionConforms to
com.microsoft.word.doc Microsoft Word document public.data, public.composite-content
com.microsoft.excel.xls Microsoft Excel workbook public.data, public.composite-content
com.microsoft.powerpoint.ppt Microsoft PowerPoint presentation public.data, public.presentation
com.microsoft.word.wordml Microsoft Word 2003 XML document public.xml, public.composite-content

iWork types

UTIDescriptionConforms to
com.apple.keynote.key Keynote document com.apple.package, public.presentation
com.apple.iWork.Keynote.key Keynote document com.apple.package, public.presentation, com.apple.keynote.key
com.apple.keynote.kth Keynote document com.apple.package, public.presentation
com.apple.iWork.Keynote.kth Keynote theme com.apple.package, public.composite-content, com.apple.keynote.kth

Office open xml

UTIDescriptionConforms to
org.openxmlformats.openxml Office Open XML public.zip-archive
org.openxmlformats.wordprocessingml.document Office Open XML word processing document org.openxmlformats.openxml, public.composite-content
org.openxmlformats.wordprocessingml.document.macroenabled Office Open XML word processing document (macros enabled) org.openxmlformats.openxml, public.composite-content, public.executable
org.openxmlformats.wordprocessingml.template Office Open XML word processing template org.openxmlformats.openxml, public.composite-content
org.openxmlformats.wordprocessingml.template.macroenabled Office Open XML word processing template (macros enabled) org.openxmlformats.openxml, public.composite-content, public.executable
org.openxmlformats.spreadsheetml.sheet Office Open XML spreadsheet org.openxmlformats.openxml, public.composite-content
org.openxmlformats.spreadsheetml.sheet.macroenabled Office Open XML spreadsheet (macros enabled) org.openxmlformats.openxml, public.composite-content, public.executable
org.openxmlformats.spreadsheetml.template Office Open XML spreadsheet template org.openxmlformats.openxml, public.composite-content
org.openxmlformats.spreadsheetml.template.macroenabled Office Open XML spreadsheet template (macros enabled) org.openxmlformats.openxml, public.composite-content, public.executable
org.openxmlformats.presentationml.presentation Office Open XML presentation org.openxmlformats.openxml, public.presentation
org.openxmlformats.presentationml.presentation.macroenabled Office Open XML presentation (macros enabled) org.openxmlformats.openxml, public.presentation, public.executable
org.openxmlformats.presentationml.slideshow Office Open XML slide show org.openxmlformats.openxml, public.presentation
org.openxmlformats.presentationml.slideshow.macroenabled Office Open XML slide show (macros enabled) org.openxmlformats.openxml, public.presentation, public.executable
org.openxmlformats.presentationml.template Office Open XML presentation template org.openxmlformats.openxml, public.presentation
org.openxmlformats.presentationml.template.macroenabled Office Open XML presentation template (macros enabled) org.openxmlformats.openxml, public.presentation, public.executable

OASIS Open Document Format

UTIDescriptionConforms to
org.oasis-open.opendocument Open Document public.zip-archive
org.oasis-open.opendocument.text Open Document text org.oasis-open.opendocument, public.composite-content
org.oasis-open.opendocument.text-template Open Document text template org.oasis-open.opendocument, public.composite-content
org.oasis-open.opendocument.graphics Open Document graphics org.oasis-open.opendocument, public.composite-content
org.oasis-open.opendocument.graphics-template Open Document graphics template org.oasis-open.opendocument, public.composite-content
org.oasis-open.opendocument.presentation Open Document presentation org.oasis-open.opendocument, public.composite-content
org.oasis-open.opendocument.presentation-template Open Document presentation template org.oasis-open.opendocument, public.composite-content
org.oasis-open.opendocument.spreadsheet Open Document spreadsheet org.oasis-open.opendocument, public.composite-content
org.oasis-open.opendocument.spreadsheet-template Open Document spreadsheet template org.oasis-open.opendocument, public.composite-content
org.oasis-open.opendocument.chart Open Document chart org.oasis-open.opendocument, public.composite-content
org.oasis-open.opendocument.chart-template Open Document chart template org.oasis-open.opendocument, public.composite-content
org.oasis-open.opendocument.image Open Document image org.oasis-open.opendocument, public.image
org.oasis-open.opendocument.image-template Open Document image template org.oasis-open.opendocument, public.image
org.oasis-open.opendocument.formula Open Document formula org.oasis-open.opendocument, public.content
org.oasis-open.opendocument.formula-template Open Document formula template org.oasis-open.opendocument, public.content
org.oasis-open.opendocument.text-master Open Document text master org.oasis-open.opendocument, public.composite-content
org.oasis-open.opendocument.text-web Open Document HTML template org.oasis-open.opendocument, public.composite-content

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 这个问题可能是由于虚拟机的显卡驱动不支持透明度导致的。你可以尝试以下几个方法来解决这个问题: 1. 更新虚拟机显卡驱动。你可以从 vmware 官方网站下载最新的显卡驱动。 2. 禁用虚拟机的 3D 加速。在虚拟机设置,点击“显示”选项卡,将“3D 加速”选项禁用。 3. 改变虚拟机的显卡类型。在虚拟机设置,点击“硬件”选项卡,选择“显示器”,然后选择不同的显卡类型进行尝试。 如果以上方法都无法解决问题,你可以尝试在主机系统打开图片,然后将图片文件共享到虚拟机。这样可以避免使用虚拟机的显卡驱动,从而解决透明度问题。 ### 回答2: 在使用VMware时,如果应用打开的图片显示为透明的,可能是由于以下几个原因引起的: 1. 虚拟机显示设置问题:首先,检查虚拟机的显示设置是否正确。打开VMware菜单,选择“编辑”>“虚拟机设置”,进入"硬件"选项卡,点击"显示器",确保选择了正确的显示适配器和显示器类型,并且分配了足够的显存。 2. 图片格式或编码问题:如果打开的图片是特定格式或使用了特定的编码方式,可能导致显示问题。尝试打开其他格式和编码的图片来查看是否存在相同的问题。如果是特定格式的图片出现问题,可以尝试使用其他图像查看器或转换工具打开和转换图片。 3. 图形驱动问题:更新虚拟机的图形驱动程序可能有助于解决透明显示问题。请确保您的虚拟机的图形驱动程序是最新的版本。您可以从VMware的官方网站下载并安装最新的图形驱动程序。 4. 主机系统和VMware版本兼容性问题:如果您的主机系统或VMware版本与您正在运行的应用程序不兼容,可能会导致显示问题。尝试在其他主机系统上运行VMware,或者升级或降级VMware版本,以查看是否解决了透明显示问题。 5. 虚拟机配置问题:考虑检查虚拟机的其他配置,例如分辨率和色彩设置。确保这些设置与您期望的一致,并满足应用程序对显示的要求。 如果上述解决方法均不起作用,建议通过在VMware相关技术支持论坛上发帖提问,可能能够得到更专业的帮助。 ### 回答3: 要解决 VMware 在应用打开图片显示透明的问题,可以尝试以下方法: 1. 检查 VMware 的设置:首先,确保 VMware 软件的版本是最新的,因为更新版本通常会修复一些已知的问题。然后,打开 VMware 的设置界面,检查图形选项。确保 "Accelerate 3D graphics" (加速3D图形)选项已启用,这有助于提高图形渲染性能。 2. 调整虚拟机的显卡设置:在 VMware ,可以为虚拟机分配独立的显卡和显存。尝试增加虚拟机的显存分配,这可以提高图形处理能力和效果。在虚拟机的设置,找到显卡选项,并尝试增加显存大小。 3. 更新显卡驱动程序:如果虚拟机的操作系统使用的是实际的显卡驱动程序,可以尝试更新显卡驱动程序到最新版本。在虚拟机打开设备管理器,找到显卡设备,右键点击选择更新驱动程序。 4. 使用虚拟机的全屏模式:如果在窗口模式下出现了透明的问题,可以尝试将虚拟机切换到全屏模式。这有助于提供更好的图形性能和完整的显示效果。 5. 调整虚拟机的分辨率:在虚拟机的设置,尝试调整虚拟机的分辨率,以匹配主机操作系统的分辨率。如果分辨率不匹配,可能会导致图像渲染问题。 如果以上方法都无法解决问题,那么可能是由于虚拟机的配置或者硬件限制所导致,建议尝试在物理计算机上运行相同的应用程序,以确认是否是 VMware 软件本身的问题。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值