NSPredicateEditor row templates not configurable in interface builder - macos

I'm creating an assistant sheet in my storyboard in interface builder. The viewController contains an NSPredicateEditor and is connected to a property of the viewController using cocoa bindings.
However, I'm not able to properly configure the row templates. When I uncheck one of the predicate operators, I'm not able to re-enable them, nor I'm able to use any of the other provided operators.
Doesn't Xcode support NSPredicateEditor anymore, or am I doing anything wrong here? Just to be clear, I'm not having any code jet.

This is a bug in Xcode. I tried this with and without storyboards and had to force quit Xcode in both cases while configuring the binding. Close and open the project and try to modify the row template before doing anything else.

Related

Unable to find UIView in UIStoryboard

I'm using Xamarin.iOS in Windows. Everything is working fine except:
Sometime ago, I'd create a UIScrollView named MyScrollView inside an UIView at MyViewController.
Right now, I can use it normally programatically like:
MyScrollView.AddSubview(myButton);
The problem is:
I can't find the MyScrollView at the Storyboard Designer. I want to change some properties at the designer.
Question 1:
Is there a way to delete it and recreate since I can't find it at designer?
Question 2:
Is there a way to use a search at the .storyboard file?
EDIT:
Even if i right click over my UIView at the UIViewController, the Context menu doesn't shows the UIScrollView.
For some reason, It was created at the storyboard back-end, however it was just not showing at the Designer.
By adding the same component with the same name: MyControllerView it didn't duplicate, and assumed the original position.
Note: Special thanks to #Yuri S. It didn't solved by this answer, but i didn't know that i'm able to edit the storyboard via XML. So lesson learnt.

Unable to see custom classes in Interface Builder drop down

I'm using Xcode 6.1.1, and cannot select my custom class from the drop down. Because of this, I believe it is causing several other related issues (see below).
Symptoms:
When using the IB drop down to choose a custom class, none of the custom classes appear.
IB_DESIGNABLE and IBInspectable do not work: When selecting the control in IB, the "Designable" status does not appear; none of the inspectable properties appear either. Debug selected views option is grayed out when selecting a view which is defined as IB_DESIGNABLE.
Ctrl-dragging items to create connections (IBOutlet and IBAction) from IB to source code occasionally doesn't allow you to "drop" the connection into the class's source code (as if there is a class mismatch). (Note: This assumes you manually typed in the class name in the Custom Class section.)
Suspected to be related: WatchKit: unable to find interface controller class
How can I fix this?
Things that worked:
Try on another machine. (This leads me to believe the machine has some setting that is messing this up.)
Reinstall Xcode.
Moving the project to a new location (in this case a git repository), fixed it once.
Things I tried that didn't work (but have worked for others):
Restart Xcode
Restart machine (this worked once before, not this time)
Create a new storyboard.
Create a new subclass (not just rename it).
Create a new project via Apple's single view template.
Cleaning the project
Deleting derived data
Reindex the project
Remove localization on the storyboard file.
Things I tried that didn't work:
Naming the subclass according to Apple's conventions (e.g. instead of View use ABCTestView).
Import the .h of the class in the .h and .m of the view controller.
Try on another version of Xcode, which is already installed (beta 6.2).
Related discussions:
https://discussions.apple.com/thread/3054574?start=15&tstart=0
Storyboard uiviewcontroller, 'custom class' not showing in drop down
This wasn't your specific situation but I was in a similar "rip my hair out" moment. When creating custom controller classes and using the interface builder, you must make sure to click the yellow button at the top of the view you're working with (the view controller button). Otherwise the custom ViewController class won't show up in the custom class drop down menu within the identity inspector.
One thing that worked for me after inexplicably seeing the issue where the "Designables" row would not appear in the Custom Class section of the Identity Inspector:
Before (not functioning: Designables did not appear and Interface Builder did not render my class):
IB_DESIGNABLE
#class MyCustomClass;
#interface MyCustomView : UIView
After (functioning: Designables did appear and Interface Builder did render my class):
#class MyCustomClass;
IB_DESIGNABLE #interface MyCustomView : UIView
So it appears that Xcode is very sensitive to the order of things.
This is what worked for me:
I somehow lost the view reference, so all i did was to drag from a little circle "New Referencing Outlet" to the main view of the .xib, and BOOM!
Here are some possible solutions:
When using the IB drop down to choose a custom class, none of the custom classes appear.
Manually type the name of your custom class instead of trying to find it in the dropdown. Sometimes IB will autocomplete the name of the class as you type, especially if you follow Apple's conventions, i.e. YourView as a subclass of NSView.
IB_DESIGNABLE and IBInspectable do not work: When selecting the control in IB, the "Designable" status does not appear; none of the inspectable properties appear either. Debug selected views option is grayed out when selecting a view which is defined as IB_DESIGNABLE.
If the view does not begin as a Custom View either dragged from the Object library or created from Editor > Embed In > ..., for some reason changing the Custom Class in the Identity inspector doesn't make a difference. To fix this, right-click the .xib and choose Open As > Source Code. Search for the view you want to fix (giving your view a label that is easily identifiable in IB will make this easier). You will find an entry like this:
<view ... customClass="YourView">
...
</view>
Change view to customView so that the entry resembles:
<customView ... customClass="YourView">
...
</customView>
then right-click the .xib again and choose Open As > Interface Builder XIB Document and you should now see a Designables entry under Custom Class in the Identity inspector of IB and Debug Selected Views will be available under the Editor menu.
Ctrl-dragging items to create connections (IBOutlet and IBAction) from IB to source code occasionally doesn't allow you to "drop" the connection into the class's source code (as if there is a class mismatch). (Note: This assumes you manually typed in the class name in the Custom Class section.)
Doesn't sound like your exact problem, but on a dual-monitor/multi-monitor setup, if IB is on a different monitor from the source code window, go to Apple menu > System Preferences... > Mission Control and uncheck Displays have separate Spaces. This may have some visual side-effects (like window drop-shadows bleeding into other monitors) but it will fix the problem of ctrl-dragging onto a separate monitor.

Add a second UIViewController within a single-view application

I have a single-view application open. I need to have two storyboard views (UIViewControllers), because one is a Table View, but when one of the Table View elements is selected it brings up another screen with a normal UIViewController. Is there any way of creating a second storyboard view (UIViewController)?
Of course! Those templates Xcode provides are in no way "set-in-stone". When Xcode created your Single-View Template, it just gave you a base for creating something more. You can create additional classes, view controllers, views, and resources (other than what Xcode starts you off with in a few ways).
To add another View Controller to your Storyboard, just drag and drop one from the Object Library:
It seems like you do not have a basic understanding of using or developing with Xcode. I would recommend reading over all of Apple's documentation on Xcode before going any further. The Building A User Interface section may be of particular interest to you.

Enable Edit Menu for NSTableView

I'm new in cocoa but with some experience with Cococa-Touch. As I am developing a OSX Lion app that uses tables (NSTableView and NSOutlineView), I am having troubles trying to add copy-paste features to tables.
I have no problems with drag-n-drop features that I have coded in table view controllers. But I cannot make edit menu options (copy and paste) enable.
I did read apple documents, but I'm missing something. I can't make it work. Can you please guide me with the first steps to enable that edit menu options and attend them from table view's controller?
I have solved it, so I answer my own question.
I have subclassed NSTableView and NSOutlineView and, in the new class, included the methods: -validateUserInterfaceItem: , copy: and so on. I was erroneously expecting to receive actions in Table Delegates.

How can i make a .XIB from .h and .m files?

I'm working on an existing project which I basically need to create a .XIB
so I can then put in UIToolbar and UIButtons ect.
On the App already it has a Tab bar but has been inputted through code and not the Interface Builder.
I would appreciate any guidance on my problem.
Kind Regards.
There is no automatic code that does this for you. You'll need to look in the code, find all UIView instances that need to go into the nib and manually create it. Then you'll have to be sure to set the frame of each of them to the same positioning as what is defined in the code. Finally, you'll have to be sure to remove all of that from the code (once it is fully migrated to the nib). Finally, you'll have to be sure that the components are referenced only after the nib has fully loaded (which might not have been the case in the current code).
Why not keep the components in the code (and just use nibs for new views)?

Resources