Preferences toolbar without BWToolkit - objective-c

Since Xcode 4, using BWToolkit isn't really easy. In fact, it's not even possible in IB.
Is there some sample code out there how to create a "preferences-type toolbar" without BWToolkit?

Yes, MVPreferencesController as used by Camino. See here for Doxygen documentation. It displays NSPreferencePanes registered using a plist. It's pretty easy to work with and customize for your purposes. You can also use the Camino project as a source of sample prefpanes.

Related

Xcode / AppleScript / Objective-C (AppDelegate.applescript)

I am having a lot of issues following this video tutorial. I'm getting hung up on the AppDelegate.applescript file. AppleScript Facelift
Here are the steps I'm taking:
1. Create a new project
2. Then I choose "App"
3.1 Options for interface
3.2 Options for Language
Save to file location - can't attach an image due to limit
5. "Template" files created
6. I can add frameworks and libraries (not sure if this is necessary? im doing things blindly...)
7. Then these are the AppDelegate files. (note- I can change the identity and type in the top right fields. if I select AppleScript Uncompiled Source, it does not change the extension)
I've tried creating a new "blank file" and saving it as AppDelegate.applescript, but I don't think this is working. Can someone point me in the right direction???
I've been working on an AppleScript project which works with my Apple Music. Someone mentioned I should look into Objective-C AppleScript, but this is making no sense. I think my end goal is having a window that allows more flexibility with input...
Thanks in advance!
The answer: I was taking a very dated approach to this and asking the wrong question.#has's suggestion to look at his project Swift-AppleScriptObjC is exactly what I needed.

Quick Help for user defined function in ios

How to show Quick Help for the methods which we wrote ...?
Like for inbuilt function when we right click on it & Click Quick Help then we get all info about that method like that I want to do for user defined methods so that any one come to know that method takes which parameter and each parameter for which purpose?
For more explanation, see these two images:
Here is a solution for that. Also check apple documentation. You might have to create document set and install it in Xcode.
Edit: Here is another similar post, How do you populate the Xcode 4 "Option+Click" popover?
There is an open source tool called appledoc which helps with this. You can provide your own documentation in the header files and then run the appledoc script which will (depending on your settings) generate the docsets, install them into Xcode, create a HTML for the documentation as well as rss feeds so that changes to the documentation can be published.

How to intercept reading of plist values in Objective-C code?

We're using the new Urban Airship iOS plugin for PhoneGap.
In the plugin's plist file, we're supposed to enter the app-specific keys needed to enable push notifications.
The problem is we have two versions, free and paid, of the same app, but the plist file only accommodates one version.
Essentially, we need to modify the Objective-C code to read different plist values, depending on whether it's the free or premium version.
We currently manage both versions with the same code base and Xcode project. Unless we change the plugin code, it seems like we need to create a new Xcode project, which we don't want to do.
How do we adjust Urban Airship's Objective-C files to read different values from the plsit file?
Sorry to keep you waiting, I wanted to give you a very detailed answer instead of rushing last night :) So here we go.
First in your project we need to add a new target. Go to your project settings and right click your target. Click duplicate.
You'll get a new target probably named Target-copy. You'll also get a new info.plist file just for that target.
Next we're going to edit our Pro version's Built Settings. Scroll or search and find Apple LLVM compiler 4.0 Preprocessing. Add to both your Debug and Release configurations. I normally just go with the simple PRO=1. You also need to add PRO=0 to your lite version or it will be undefined when you try to build that version.
Now lets look at how to add a custom plist like I'm sure you'll need. First create two folders. Its important these are folders not groups. In each folder we can create a plist with the exact same filename.
Since Now you can add something to each of them. I just added a key property and a value pro string / lite string. Finally to the code. In the sample project I made I simple overrode viewDidLoad but obviously this will work anywhere. Since the plists have the same name you can load them with one line of code. They'll never get mixed up because they are only copied to their respective target. If you need to do code level based logic you can use the PRO preprocessor we made.
- (void)viewDidLoad
{
[super viewDidLoad];
// This will load the proper plist automatically.
NSLog(#"Plist Value: %#",[[NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:#"Property List" ofType:#"plist"]] objectForKey:#"property"]);
// Also remember we set up a preprocessor PRO. you can use it as well.
if (PRO) {
NSLog(#"Only Show for Pro");
} else {
NSLog(#"Only Show for Lite");
}
NSLog(#"This will show for both");
}
This is the method I use for all my lite/pro version apps so I can share a common codebase without copying it between projects or other complicated systems. It has worked pretty well for me so far :) Happy Coding!
Source
Figured someone may be able to use the project to look at so here it is on GitHub.

Multi language localization storyboard support issue

I have an issue with my project storyboard. I have added two localizations more to storyboard, so now I have three storyboards: spanish, english and basque. All of them depending from the main one:
Now I have the issue that I have to update all changes manually to all to storyboards, because if I do changes to MainStoryboard, the others are not updated with this changes.
How can I modify all storyboards at the same time?
Thanks
Here is a really great tutorial for automating changes from one storyboard localization to all the others:
http://danielsaidi.wordpress.com/2012/08/20/localization-in-ios/
http://www.youtube.com/watch?v=cF1Rf02QvZQ
From what I gather, the solution involves adding a python script to the end of the build that syncs the storyboards and generates string files.
Go to the links for a more detailed solution. They said it better than I can.
You could either take out all the strings from Storyboard and put them in localized set of strings. Then you would have to do everything in your code like this:
self.label = NSLocalizedString("LABEL_STRING", nil);
or you could open the Storyboard as an XML file and do it there maybe a little faster. But other than that, no it is not doable, bcs the Storyboard localization serves you for polishing your localization. Say you have a screen called "HOME" and then (using google translate), you have "HASIERA" in basque. The problem here is, that in basque it's longer, so you need to adjust the GUI elements so it fits the screen perfectly. What could happen is that the string would be cut off, which we don't want to happen. That's why you need to do Storyboard localization step by step. If you don't need it, use strings file instead...

Custom key bindings Xcode 4?

Awhile back I asked a question about custom key bindings in Xcode. I ended up recreating some of TextMate's key commands in Xcode. Just updated to Xcode 4 and it appears that the PBKeyBinding file no longer has any effect. What's the new hotness for custom key bindings, specifically for Xcode 4?
Yes, it can be done (at least for the moment). After spending the better part of a day searching, experimenting and digging through the bowls of /Developer I finally figured out how to accomplish this.
Open IDETextKeyBindingsSet.plist located in /Developer/Library/PrivateFrameworks/IDEKit.framework/Resources/
This bindings plist is formatted differently than others used throughout the system, the most important distinction is that all the methods must be listed in the same string, i.e.
<string>moveToBeginningOfParagraph:, insertText:, foo</string>
edit:
I have not tested this, but it looks like the new location in Xcode is
Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist
You can use Keymando to create any keybinding you like in Xcode 4 and any other OSX application.
The answer now seems to be to use the idekeybindings files — these are tied to the custom keyboard shortcut sets you create in the preferences — stored at ~/Library/Developer/Xcode/UserData/KeyBindings/. More information can be found in the Key Bindings Preferences Help. However it sounds like people are having no luck trying to combine multiple actions under one keyboard shortcut (as you can do with the older-style key bindings dict files). But presumably you could still do this in DefaultKeyBinding.dict, as long as you don't mind the shortcut also working in other applications :) If this doesn't work, I think you're out of luck for now. Sorry; file a bug!
Kike here http://www.codedojo.com/?p=580
you use this binding set
Download
http://www.codedojo.com/files/MSVC_xcode_config.zip
unzip it and place MSVC.pbxkeys in YourUserName/Library/Developer/Xcode/userdata/keybindings
and rename it to msvc.idekeybindings
then from
Xcode -> preferences -> keybindings
just pick msvc
Go to Xcode 4 > Preferences > Key Bindings and fiddle with them all you like. :)