iboutlet

Xcode 5 - ios 7 - Unlock Levels when one level is completed

点点圈 提交于 2019-12-02 08:21:54
I have the main viewcontrols with 3 levels (3 x UIButtons) . The first one is visible while the other two are hidden. The second and third levels are going to be visible just when the previous level is completed. For example in level 1 when i chose the right question level 2 button became visible and so on. here an example Is there a simple way to achieve this? I am new to xcode and I just cannot figure out how to connect the continue button to unhide the level. here the link with the project file. http://salvonostrato.com//ex/xcode5/TESTlevels2.zip Any help is appreciated In ViwController.h i

Accessing IBOutlet from other classes

馋奶兔 提交于 2019-12-02 05:40:45
问题 I have a document based cocoa application with an item in the application menu hooked up to an IBAction . Clicking the item needs to perform a task that uses an IBOutlet in the main nib file which is using another class, MyDocument . Creating 2 objects of the same class, one in each nib seems to not be working. How can I access the outlet? 回答1: Actions for menu items are often sent to the first responder so that whatever is currently selected can act on it. It sounds like this action is

Accessing IBOutlet from other classes

[亡魂溺海] 提交于 2019-12-02 03:18:34
I have a document based cocoa application with an item in the application menu hooked up to an IBAction . Clicking the item needs to perform a task that uses an IBOutlet in the main nib file which is using another class, MyDocument . Creating 2 objects of the same class, one in each nib seems to not be working. How can I access the outlet? Actions for menu items are often sent to the first responder so that whatever is currently selected can act on it. It sounds like this action is something that works on the current document, then it should be implemented by the document. In this case have

How to connect outlets and actions in Swift / MacOS programaticly

帅比萌擦擦* 提交于 2019-12-02 00:25:42
问题 I have a simple example. I connected the left button1 and label1 with ctrl-draging it to the contollerclass. How can I do the same for the right button2 label2 programaticly (without ctrl-draging) That´s my code: class ViewController: NSViewController { @IBOutlet weak var label1: NSTextField! //connected with ctrl-drag @IBOutlet weak var button1: NSButton! //connected with ctrl-drag @IBOutlet weak var label2: NSTextField! //not yet connected @IBOutlet weak var button2: NSButton! //not yet

How to connect outlets and actions in Swift / MacOS programaticly

别等时光非礼了梦想. 提交于 2019-12-01 20:31:31
I have a simple example. I connected the left button1 and label1 with ctrl-draging it to the contollerclass. How can I do the same for the right button2 label2 programaticly (without ctrl-draging) That´s my code: class ViewController: NSViewController { @IBOutlet weak var label1: NSTextField! //connected with ctrl-drag @IBOutlet weak var button1: NSButton! //connected with ctrl-drag @IBOutlet weak var label2: NSTextField! //not yet connected @IBOutlet weak var button2: NSButton! //not yet connected @IBAction func button1Pressed(_ sender: Any) //connected with ctrl-drag { label1.stringValue =

Custom outlets in NSCollectionViewItem subclass

笑着哭i 提交于 2019-12-01 11:33:13
I feel this being a simple task, but I don't seem to be able to make it work. I'm trying to have a NSCollectionView with custom items. I added another NSImageView to the custom view of the item, and I subclassed this view in order to add the custom outlet connected to this additional NSImageView. Now I am overriding - (NSCollectionViewItem *)newItemForRepresentedObject:(id)object because sometimes I need to remove this NSImageView. - (NSCollectionViewItem *)newItemForRepresentedObject:(id)object { CustomItem *theItem = (CustomItem *)[super newItemForRepresentedObject: object]; ... if (I need

Update Label On Another View

心不动则不痛 提交于 2019-12-01 10:29:50
I have two views with a label on one of them. On the second view, there is a button. What I want to achieve here is to be able to press the button and it updates the label on the first view. How do I do that? I can't access the IBOutlet from the second view. Is there something that I have to do to the IBOutlet to make it public etc? You can use NSNotificationCenter for that. First of all in your viewDidLoad method add this code in your firstViewController class: NSNotificationCenter.defaultCenter().addObserver(self, selector: "refreshlbl:", name: "refresh", object: nil) which will addObserver

Custom outlets in NSCollectionViewItem subclass

时光毁灭记忆、已成空白 提交于 2019-12-01 09:18:08
问题 I feel this being a simple task, but I don't seem to be able to make it work. I'm trying to have a NSCollectionView with custom items. I added another NSImageView to the custom view of the item, and I subclassed this view in order to add the custom outlet connected to this additional NSImageView. Now I am overriding - (NSCollectionViewItem *)newItemForRepresentedObject:(id)object because sometimes I need to remove this NSImageView. - (NSCollectionViewItem *)newItemForRepresentedObject:(id

How Do I Access IBOutlets From Other Classes in Objective-C?

☆樱花仙子☆ 提交于 2019-12-01 05:51:10
How do I access IBOutlets that have been created in another class? For example, if I have an IBOutlet in Class A how can I access in Class B ? If I can not access IBOutlets from other classes what is a work-around? You'll need to make your IBOutlet a @property and define a getter for that property via @synthesize or you can define your own getter, here's an example of the former: @interface ClassA : NSObject { UIView *someView; } @property (nonatomic, retain) IBOutlet UIView *someView; @end @implementation ClassA @synthesize someView; ... @end Then, in ClassB , you can do this: @implementation

How Do I Access IBOutlets From Other Classes in Objective-C?

被刻印的时光 ゝ 提交于 2019-12-01 04:10:58
问题 How do I access IBOutlets that have been created in another class? For example, if I have an IBOutlet in Class A how can I access in Class B ? If I can not access IBOutlets from other classes what is a work-around? 回答1: You'll need to make your IBOutlet a @property and define a getter for that property via @synthesize or you can define your own getter, here's an example of the former: @interface ClassA : NSObject { UIView *someView; } @property (nonatomic, retain) IBOutlet UIView *someView;