I know how to delete an item using a button but I can get that from a menuitem. The issue is that MenuItem inside findViewById gives an error, it says it is not within the bounds.
MenuItem inside findViewById gives an error
I tried declarating a variable for MenuItem but it doesn't work. However, I can declarate a button or anything else, so I don't understand what is happening.
Thanks for helping!
Related
Is it true that when the back button is taped, the current view is destroyed?
If so how can I prevent this?
I'm getting this idea because if I set an active item (item gotten by using Ext.getCmp) on the navigation view, tap on the back button and then set the active item again, the Ext.getCmp returns undefined.
Any ideas, solutions or workarounds for my problem?
Property autoDestroy is responsible for that. Note that it should be set for Navigator and affect on the children destroying, not to the Navigator itself. If it set to true - all poped items would be destroyed by back action, otherwise will be kept in memory
Cheers, Oleg
So i would like to use the UIMenuController to display text. i would like to add in help buttons (press a little button and something will pop up describing what something does) that would display either a UIMenuController or something that looks similar to it. it would just display a few lines of text and dismiss when pressed.
it kinda looks like UIMenuController is only meant for button selection. i could just use one button and set the title to the message i wish to display, but am doubtful on how well that would work. are there any other options available?
A UIMenuController takes it content from its menuItems property and the documentation says :
The default value is nil (no custom menu items). Each menu item is an
instance of the UIMenuItem class. You may create your own menu items,
each with its own title and action selector, and add them to the
editing menu through this property. Custom items appear in the menu
after any system menu items.
So you are obliged to use UIMenuItem objects as content for your UIMenuController. UIMenuItem only inherits from NSObject, and stores only a title and an action, both required. This make you unable to use any other kind of data as UIMenuItem.
As it is not an UIView, you can give it a UIButton or a UIImageView.
You could think to override UIMenuController but again it is a direct child of NSObject, so it doesn't have any behavior for customization.
The only solution left to you, is to rewrite your own UIMenuController, deriving it from UIToolbar for example. This would give you more or less the same look, you just have to customize the arrow and the round corner.
I dont have time right this second to put some sample code, (Ill edit my question tomorrow and add some) but basically what happens is that I have a Window. It works fine usually, but if I use
[myWindow setStyleMask:NSBorderlessWindowMask]
to make it borderless, the NSTextView it contains will stop gaining focus even when you click on it: the ring will never appear, the cursor wont change and the scroll bar will remain gray.
Something else that happens when I make it borderless is that it wont update! I basically have this
[lyricsView setString:someString];
to update the string inside it. The Console marks me no errors, but the string wont appear in the Text View unless I click on it.
All of this stops happening if I remove the line setting the styleMask to Borderless. Any ideas? Suggestions? Comments? Cheers?
Thank You!
Kevin
From the documentation of NSWindow:
The NSWindow implementation returns YES if the window has a title bar or a resize bar, or NO otherwise.
So subclass your window and add this line
-(BOOL)canBecomeKeyWindow
{
return YES;
}
I have a collection view item and its prototype view. Within that prototype view I have a little x button. I want that button to remove the exact collection view item that it is on top of.
I can remove a selected item if I click on the space around the x button but if I go straight to clicking the button before clicking the item it will only erase the last selected item.
ideas?
Alright, this should be fun!
Step one: Change the method signature of removeQuartzPlayer to be:
-(void)removeQuartzPlayer:(id)aPlayer;
Where aPlayer will be the player you want to remove. Change the implementation to look something like this:
[quartzPlayerArrayController removeObject:aPlayer];
Where quartzPlayerArrayController would be replaced with the name of the outlet to the NSArrayController that your collection view is connected to. I'll trust that you can figure out how to create an IBOutlet to it, if you don't already have one.
Step one-point-five: remove the connection between the button and the removeQuartzPlayer method in IB.
Step two: Switch to the Bindings pane of the IB Inspector. Select the "Target" binding and make it look like this:
Where the "Controller" popup would be set to whatever object points to your controller.
Step three: Select the "Argument" binding and make it look like this:
Where the "Collection View Item" popup... you get the idea.
Step four: Enjoy your new button, brought to you by the (dark) magic of Cocoa Bindings!
Disclaimer: I haven't actually tested this, but since I have a button that does something similar, it should work. Comment away if I've screwed something up.
Billy
my popUpButton is in a window with a group of popUpButtons. If I try to click the 2nd of 4 vertically aligned buttons then the popdown menu will not appear. If I select the 3rd or 4th then the 2nd will now be selectable.
throughout my code the setEnabled on that popUpButton is :YES.
ideas on where to look in my controller?
This is a Objective C/Cocoa Question.
the solution was in the -validateMenuItem code... I wasnt checking for a return value of null somewhere that method and it was logically returning false.