Geek@Paris

How to manually remove the Interface Builder plugin dependency for BGHUDAppKit

2012-08-07

Xcode 4 doesn’t support Interface Builder Plugin any more, so we have to remove all 3rd party Interface Builder Plugins.

Unfortunately, all the *.xib files in my project can’t be managed by Xcode 4 automatically, it told me that the given plugin file of BGHUDAppKit can’t be decoded by some errors…So I have to remove the plugin dependency by hands without any other choice:(

The following list is the procedure which I succeeded with at last.

  • Open your *.xib files with Interface Builder 3.2.6 (which is included in Xcode 3.2.6), press OPT+CMD+I to open the Info panel, change “Development Target” to “Interface Builder 3.2”.
  • Search “BGHUD” in the search field, and change all BGHUD controls’ class name to their corresponding class name but with a redundant letter among “BGHUD”, like “BG0HUDButtonCell” for “BGHUDButtonCell”.
  • CMD+S, save all your modifications.
  • Open your *.xib files with any text editor (Such as Kod, Sublime Text 2, TextMate, etc.)
  • Find a block like the following one:
    <dictionary class="NSMutableDictionary" key="IBDocument.PluginVersions">
      <string key="com.apple.InterfaceBuilder.CocoaPlugin">851</string>
      <string key="com.binarymethod.BGHUDAppKitPlugin">1</string>
    </dictionary>
  • Remove this line:
    <string key="com.binarymethod.BGHUDAppKitPlugin">1</string>
  • Find another block like the following one:
    <array key="IBDocument.PluginDependencies">
      <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
      <string>com.binarymethod.BGHUDAppKitPlugin</string>
    </array>
  • Remove this line:
    <string>com.binarymethod.BGHUDAppKitPlugin</string>
  • Then search all the following line:
    com.binarymethod.BGHUDAppKitPlugin
  • Replace them with:
    com.apple.InterfaceBuilder.CocoaPlugin
  • Search all BGHUDLabel, and replace them with NSTextField.
  • Search all BGHUDTableViewHeaderCell, and replace them with NSTableHeaderCell.
  • Search all BGHUDTableCornerView, and replace them with NSView.
  • Search all >BGHUD, and replace them with >NS.
  • Search all “BGHUD, and replace them with “NS.
  • Search the following line and replace them with empty.
    <string key="themeKey">gradientTheme</string>
  • Then search themeKey again to check if there is any other themeKey. If any exists, write down these keys somewhere else and remove them too.
  • Search all BG0HUD, and replace them with BGHUD.
  • Open your *.xib files by Interface Builder 3.2.6.
  • If you have any customized theme key, click on the related control’s cell, press CMD+6 and add a new attribute in User Defined Runtime Attributes.
  • Choose string type, its Key Path is “themeKey”, and its value is the name of your customized theme key.
  • If you have any Radio Button or Checkbox with BGHUDButtonCell, you have to add another attribute to its cell. Its type is Number, Key Path is “buttonType”, value is 3 for Checkbox, 4 for Radio Button.

  • If you have customized the Gradient colors of a BGHUDView, to have the same effect without plugin, you can create a subclass for that view, and add the following codes in Xcode.
    @interface MyCustomizedView : BGHUDView
    @end
     
    @implementation MyCustomizedView
    - (void)awakeFromNib {
    	[self setUseTheme:NO];
    	[self setFlipGradient:NO];
    	[self setColor1:[NSColor colorWithDeviceWhite:0.0f alpha:1.0f]];
    	[self setColor2:[NSColor colorWithDeviceWhite:0.5f alpha:1.0f]];
    	[self setBorderColor:[NSColor colorWithDeviceWhite:1.0f alpha:1.0f]];
    	[self setDrawBottomBorder:YES];
    }
    @end
  • Then set this view’s class to “MyCustomizedView” in Interface Builder.
Author:admin | Categories:Dev | Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *


Clickcha - The One-Click Captcha