Unable to setitems in tableview - javafx-8

What does this error mean?
setItems (javafx.collections.Observablelist<java.lang.String> in TableView cannot be applied to (javafx.collections.ObservableList<sample.Menu>)
I have a class called Menu and a package called sample.

Related

Why doesn't Interface Builder see my class in the static framework?

There is a Cocoa framework project called MyFramework with Mach-O Type set to Static Library that features MyView.swift with a following declaration:
open class MyView: UIView { /* ... */ }
In the meantime, another project called MyApp statically links against the static framework MyFramework. Additionally, Main.storyboard of MyApp has a scene in which there is a view, whose custom class is set to MyView and module is set to MyFramework.
Whenever the view controller that backs this scene is instantiated, the view behaves as a default UIView and I see the message in console:
2018-06-23 18:22:29.114096+0700 MyApp[2318:415810] Unknown class _TtC15MyFramework15MyView in Interface Builder file.
Then, I add to MyApp's target a MyNewView.swift with the following declaration:
class MyNewView: MyView { }
Without changing anything in the Main.storyboard, I launch the app, the MyView class gets instantiated, it behaves as supposed and the message doesn't appear.
Question #1: why does this happen? Is the type stripped or not registered with the Objective-C runtime if it's not directly imported or referenced from anywhere in code? Or maybe is it somehow lazily loaded?
Question #2: what can I do with it so that I don't need to apply such workarounds?
Update: I restarted the Xcode and the issue did not persist, yet still, the interface builder doesn't suggest MyFramework as a module while typing in the Module field in view's identity properties, and the #IBInspectables of MyView don't get parsed, don't show up in the interface builder, in the view's attributes.

How to call a ViewController from a UITableViewCell class

I have a UITableView Class which controls the items in my custom cell. With one of these items I need to respond by moving to my LoginView. I set up a UITapGestureRecognizer with the selector called priceClick(). In this method I need to call buildNewLoginView but obviously can't use a segue so I call a class in my MenuViewController to show LoginView.
func priceClick() {
MenuViewController.buildNewLoginView(MenuViewController)
}
This just throws an error
'Expression resolves to an used function'
What can I change so that I can call this method?
Both replies helped to fix my problem but the reply from Abinav was the solution I used and it worked perfectly by using a Protocol to declare the delegate which was assigned to my cell in cellForRowAtIndexPath.

How to reload the UIViewController

Can anyone please tell me how to reload the view.In my program,it contain a tab view controller.There is one item named "A" in the tab.And this "A" item is pointing to a viewController.In that view Controller, it is displaying some datas and I have included UIActionSheet in that. There is one button-Delete in the actionsheet.This delete button is for deleting the particular data.Now my problem is that I need to reload that view so that these deleted data should not be displayed. So anyone please tell me how to reload the page. I have included the following code before
[self presentModalViewController:historyView animated:YES];
[historyView setNeedsDisplay];
but it is showing some error :-
No visible #interface for viewcontroller declares the selector 'setNeedsDisplay'
Please tell me the solution.. :(
UIViewController class doesn't have a method setNeedsDisplay. The UIView class does have this method. So you can write like that:
[historyView.view setNeedsDisplay];
But this method doesn't reload a view. It just marks the receiver’s entire bounds rectangle as needing to be redrawn (from apple documentation iOS Developer Library). So as a result the drawRect method will be called.
To solve your problem you can create your own function like initializeUI in your view controller and then call it when the view is loaded initially (in viewDidLoad method) and for example after deleting the data when you need the view to be updated.

UISplitViewController selector not recognized from MasterViewController

I have a custom UISplitViewController, created so I can present a login screen to the user. In this controller I also have a logout method.
The logout button is in the navigation bar of the MasterViewController. When the user clicks logout, I am trying to call the UISplitViewControllers logoutUser method. First I tried:
[self.splitViewController logoutUser:self];
This gave errors when trying to compile:
No visible #interface for 'UISplitViewController' declares the selector 'logoutUser:'
I then commented out the offending line and added the following if, checking to see if indeed my UISplitViewController responds to the selector.
if([self.splitViewController respondsToSelector:#selector(logoutUser:)]){
// [self.splitViewController logoutUser:self];
NSLog(#"Selector");
}else{
NSLog(#"No Selector");
}
In the log when running I get Selector. uncommenting the [self.splitViewController logoutUser:self] I get the same error.
I tried to clean the build and rebuild but it still gives this error. How cna I resolve this issue?
Thanks,
Bruce
It seems that self.splitViewController is of the base splitViewController and the compiler is not able to find the logoutUser method. However, at runtime the splitViewController can respond to the method.
As you said your splitViewController is custom, try casting to the custom controller:
[(yourCustomViewController *)self.splitViewController logoutUser:self];
Any message can be sent to any object in Objective-C, as long as the method is declared somewhere in the current scope (i.e. it is declared in some class in some header that is imported).
There could be two problems you are referring to:
You did not import a header that contains the method. (The class it's declared in doesn't even have to be the same as the class you're calling it on now; it just has to be declared somewhere.) In this case, you will get a warning that the method is not found, and it will assume that the method returns type id. You can fix this by importing the header of your custom view controller.
Since self.splitViewController is type UISplitViewController *, and logoutUser: is not a method of UISplitViewController, you may get a warning (not error) that it may not respond to that method. This is a result of static type checking because UISplitViewController * is a concrete type. You can fix this by either
Casting it to a type that does support that method, as Enrique's answer suggests; or
Casting it to type id so it does not do static type checking, e.g.
[(id)self.splitViewController logoutUser:self];
As commented above, I found the answer:
[self.splitViewController performSelector:#selector(logoutUser:) withObject:self];

App Crashes when trying to add cells to tableView

I am using an NSMutableArray to populate my tableView.The array's name is cells. I have a button that adds cells, but when i press the button, the app crashes. The code in my button is:
- (IBAction)outlet1:(id)sender {
[cart.cells addObject:#"1"];
[cart.myTableView reloadData];
}
this button is on a seperate page from the table view, so cart is referring to the tableView page. Any help would be appreciated! Thanks
The exception message means that someone is trying to call a method named outlet1 that has no argument (note the missing colon) while your method's signature is outlet1:. You have probably missed the colon of the selector when adding the target/action to your button.