I want to use this excellent UICollectionView layout: https://github.com/bryceredd/RFQuiltLayout
As expected, it wants me to set my Collection View's layout class to it. This can't be done, because Xcode does not accept RFQuiltLayout in the class field (beeps, and clears the field if I select anything else).
I tried this with a new, empty project too.
What did I wrong?
(Tried in both Xcode 4.2.1/iOS 6 and Xcode 5/iOS 7, OS X Mavericks.)
You are probably trying to set it in the Class field of the Identity Inspector, which is for the UICollectionView's class or subclass.
Instead, open the CollectionView's Attributes Inspector, select Layout > Custom and below Class > RFQuiltLayout:
Related
Maybe I'm just doing something wrong here but I've ran into an issue that I can't find a solution for. Maybe someone has seen this?
Using Xcode 6, I create a new project with Objective C & Storyboards.
In the interface builder view, I place a text field on the view that comes with the storyboard and bind it to the 'Shared User Defaults Controller'. Everything works fine.
I add a second view controller. This creates a new scene. I place a text field on this view and bind it to the 'Shared User Defaults Controller' and here's the issue:
A 'User Defaults Controller' gets created in the scene. If I expand the dropdown list for 'Value' 'Bind to', there are now 2 'User Defaults Controller' objects in the list. The binding doesn't seem to work as the value doesn't get stored in the preferences file.
Did I do this wrong? Or is it a bug in OS X storyboards on Xcode 6?
Yes, it is a bug in Xcode 6 with Storyboards. I found a workaround: edit the storyboard manually.
First bind an item to the shared preferences on one scene. Then close the storyboard and edit it as source (edit the xml directly).
Find the line representing the shared user preferences instance. It should look something like that:
<userDefaultsController representsSharedInstance="YES" id="a6K-Ly-rL1"/>
You can then copy this line in each scene, in the objects array, in the xml directly.
You must edit the id of each shared preference instance added manually because a storyboard file cannot have more than one object with the same id. Simply changing one character at random in the id string is enough.
My workaround is to add an NSObject to the storyboard scene and use my custom class
#objc(SharedUserDefaultsControllerProxy)
public class SharedUserDefaultsControllerProxy: NSObject {
lazy var defaults = NSUserDefaultsController.sharedUserDefaultsController()
}
then bind on self.defaults.values.
Hi initially I had an application where the app delegate defined the initial view controller to be an .xib of some other class. I deleted this class, its header and its .xib because I wanted the initial view controller to be of another class.
In the app delegate class I deleted the original reference from the class I did not want and typed
self.window.rootViewController = [[NewClass alloc] initWithNibName:#"NewView" bundle:nil];
This works like a charm as the initial view is now "NewView". However the console gives me an error of the title above. I did a search on the whole project of the deleted class and there are no references to it. Furthermore I even deleted the actual files. Also, I deleted the simulator's cache.
Thanks in advance.
Well the error says that there is an unknown class in IB. So look through all of your xib/storyboards. I am almost certain a view, controller, etc... (whatever your subclass was of), is declared using that class.
Searching all of your files or code for that class will not help since it is an Interface Builder error, so check around there.
I downloaded the sample xamarin.mac hello world project and when I try to run I get a null reference exception on the outletes when it runs. I see the outlets get properties set to them in the MainWindow.designer.cs partial classes but when it tries to reference them in MainWindowController.cs a null reference exception is thrown.
How does the sample project work when the property definitions are in the MainWindow.cs partial class and not in the controller class. Is the sample project supposed to work out of the box?
I am not familiar with the hello world example, but I come across this problem all the time in native Mac/Xcode land and I just hit it again inside Xamarin Studio. My problem happened to be this: I have a GUI full of NSTextFields. I wired each in turn to a new outlet in MainWindowController.h, however I accidentally re-wired the second NSTextField in my list to the outet I'd previously defined for the first TextField. This automatically disconnects the previous link, and even though the outlet remains defined in the .h, the connection in the .xib is broken and thus the first outlet never gets initialized with the xib's NSTextField instance.
The solution is basically right-click the GUI element in question in interface builder and be sure its referencing outlet is actually wired up to the outlet you expect in the .h.
I'm new to mac development. I developed an application using the NSTabView in which al worked fine for me.
But later I wanted to change the UI so I used NSSplitView in this I'm able to display the xib, but the button action are not happening, and I'm getting an error:
Could not connect the action cancelAction: to target of class NSViewController".
- (IBAction)cancelAction:(id)sender
{
[self enableNewProductAction];
}
How can I fix this problem?
Somewhere, you'll have an object in your XIB file that has its class set to NSTableView instead of your custom subclass. Find that and change it, and you'll be set.
I have a project in Xcode 4.5 with storyboard.
I want to use a separate xib file for one piece of UI (long story) but I don't know how to connect this to the ViewController for this file. I created a separate FooViewController which is a subclass of UIViewController. However, it won't let me set this as the class for my xib (I get a beep indicating the name is invalid)
Weirdly, I can set it to some nonsense string that isn't a class in my project!? What am I doing wrong?
Rob answered in the comments to my question. Basically I was setting the class for the View and not the File's Owner as I should have been.