iboutlet

How to connect an IBOutlet from an UITableViewController directly to custom cell?

萝らか妹 提交于 2019-12-21 04:40:53
问题 A few days ago, I watched the video tutorial which explains how to use custom cells in an UITableViewController. I've learned that I can prepare a custom cell directly in the interface builder, so I did following: I created a UITableViewController and connect a custom class which consists of an IBOutlet (UILabel). After that, I switched in my storyboard and prepared my custom cell with an UILabel. Finally I connect the label from UITableViewController to my custom cell directly. The following

IBOutlet for NSTextView in a ARC project

孤街醉人 提交于 2019-12-20 17:26:10
问题 As you read here in most cases a IBOutlet should be weak. Now as you can read in the development library not all classes support weak references. (e.g. NSTextView). This means you have to use assign: @property (assign) IBOutlet NSTextView *textView; If you use a weak reference you will get the following error: "Synthesis of a weak-unavailable property is disallowed because it requires synthesis of an ivar of the __weak object" What the documentation missed to mention is now you have to set

IBOutlet and viewDidUnload under ARC

最后都变了- 提交于 2019-12-20 08:37:46
问题 There is a similar question to this on SO here, however I just want to clarify something that wasn't fully explained there. I understand that all delegates and outlets - in fact any reference to a "parent" object, to be a good citizen and think about the object graph for a minute - should be zeroing weak references. Due to the nature of zeroing weak pointers automatically dropping to nil on the referenced object's retain count reaching zero, does this mean that setting IBOutlets to nil in

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

杀马特。学长 韩版系。学妹 提交于 2019-12-20 04:58:13
问题 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

How to find the UI element connected to a specific IBOutlet?

狂风中的少年 提交于 2019-12-20 01:12:00
问题 Is there any way to find which UI element an IBOutlet declared in code is connected to? 回答1: Go to your view controller file where you have declared IBOutlet (.h or .m). Then you can see left side of each variable declaration there is a dark grey round image. (It is filled if you have connected that IBOutlet with Storyboard/Xib unless it is unfilled.) By clicking that image you can see small popover which shows connection of outlet. See below image will show you. 来源: https://stackoverflow.com

Update Label On Another View

假装没事ソ 提交于 2019-12-19 10:31:57
问题 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? 回答1: You can use NSNotificationCenter for that. First of all in your viewDidLoad method add this code in your firstViewController class: NSNotificationCenter

Can't affect UITextView content with initWithCoder

ε祈祈猫儿з 提交于 2019-12-19 09:54:34
问题 I'm trying to get a string displayed in my UITextView the moment the app is launched. I have a UIView and a UITextView in my interface, and one outlet, myText , which is connected to the UITextView . It doesn't seem to be working and I can't say why.... Here is the code in question: MainView.h #import <UIKit/UIKit.h> #import <Foundation/Foundation.h> @interface MainView : UIView { IBOutlet UITextView *myText; } @end MainView.m @implementation MainView -(id) initWithCoder:(NSCoder *)coder { if

How to access IBOutlets declared in superclass?

。_饼干妹妹 提交于 2019-12-18 12:20:28
问题 I'm currently refactoring a couple of view controllers that share a few IBOutlet s and IBAction methods. I moved the outlet declarations and the IBAction method into a superclass, cutting these out of the subclasses. Now, when I open up Interface Builder, I find that I can't see the outlets or actions declared in the superclass. The connections still exist, as I'd wired them up before the refactoring, but they're grayed out. (It's important to note that the connections also WORK, as my action

iOS loadNibNamed confusion, what is best practice?

半城伤御伤魂 提交于 2019-12-17 22:39:22
问题 I'm familiar with most of the process of creating an XIB for my own UIView subclass, but not everything is working properly for me - it's mostly to do with the IBOutlets linking up. I can get them to work in what seems like a roundabout way. My setup is this: I have MyClass.h and MyClass.m. They have IBOutlets for a UIView (called view) and a UILabel (called myLabel). I added the 'view' property because some examples online seemed to suggest that you need this, and it actually solved an issue

Interface Builder, @IBOutlet and protocols for delegate and dataSource in Swift

和自甴很熟 提交于 2019-12-17 18:22:17
问题 Can't connect delegate property of CustomView declared as @IBOutlet to ViewController in Interface Builder – simply can't establish a connection. Here's the code class CustomView: UIView { @IBOutlet var delegate: CustomViewDelegate? } @objc protocol CustomViewDelegate { ... } class ViewController: UIViewController, CustomViewDelegate { ... } @objc is used because of swift protocol, IBOutlet property cannot have non-object type, don't know why protocol CustomViewDelegate: class {} doesn't work