iboutlet

Is it true Xcode/IB DOES NOT check for protocols?

一曲冷凌霜 提交于 2019-12-11 06:55:52
问题 Xcode5 milieu only. (Not older versions.) 1) make a new class called say Test. it's a UIViewController @interface Test:UIViewController 2) in storyboard, make a new screen, a UIViewController, change it to "Test" obviously, if you add a control (say, a button) on the storyboard, you can drag it to an IBOutlet defined in Test.h. No problem. 3) Now in Test.h add the two protocols .. @interface Test:UIViewController < UICollectionViewDataSource, UICollectionViewDelegateFlowLayout > 4) now in IB

Linking Label to IBOutlet gives NSUnknownKeyException

一世执手 提交于 2019-12-11 06:18:58
问题 I have created a TabBarView. On one of the tabs, I have a View with several Labels on it. It works fine. When I connect the Labels in Interface Builder to the File's Owner (the corresponding IBOutlets) then the App crashes with the following error when I open that tab: 2011-05-15 18:36:29.070 AeroNav[958:707] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x18afe0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for

Objective-C nil Outlets

霸气de小男生 提交于 2019-12-11 04:58:15
问题 I have a class used for a user interface, with two constructors: - (id)initWithBanner:(NSMutableArray *)banner { if ( ( self = [super initWithNibName:@"UIBanner" bundle:nil] ) ) { // ... code... } return self; } - (id)initWithPreview:(NSMutableArray *)previews { if ( ( self = [super initWithNibName:@"UIBanner" bundle:nil] ) ) { // ... code... } return self; } Inside this two constructors, I use two outlets, a UIPageControl and a UIScrollView, linked with the new XCode 4. Now, if I use the

IBOutlet to two viewControllers on two storyboards… is that possible

穿精又带淫゛_ 提交于 2019-12-11 04:05:58
问题 I have an app with two targets, for iPhone and for iPad. This project is not using size classes. On the iPhone version I have a storyboard that contains a viewController called “termsAndConditions”. This viewController has class files termsAndConditions.h and .m. Inside termsAndConditions.m I have an outlet linked to a textView on the viewController. Then I have the second target for iPad. I have the same viewController there called “termsAndConditions”. My idea was to use the same class

A few IBOutlets pointing to nil

心已入冬 提交于 2019-12-11 04:02:26
问题 After a long while I've finally started working with Objective-C again, on my only complete app so far. The goal is to eventually refactor for ARC and possibly storyboards, but for the time being I'm polishing the iOS 4.x target. I am quite rusty, so bar with me if this is a stupid question. I have a button in my main view that triggers the showAction method. The method is as follows: - (void)showAbout { AboutViewController *aboutView = [[[AboutViewController alloc] init] autorelease]; if (UI

IBOutlet is nil

不羁的心 提交于 2019-12-10 21:16:41
问题 I have created a standard outlet for a view that will hold different information based on the button selected on the previous screen. @IBOutlet weak var labelView: UIView! It shows it is connected in both the story board view and on the code itself, however, every time I get to any reference to the labelView such as: if detail.description == "About" { labelView.backgroundColor = UIColor.red } Then the app crashes out with: fatal error: unexpectedly found nil while unwrapping an Optional value

UIStoryboard Container Attach IBOutlet To Parent ViewController

 ̄綄美尐妖づ 提交于 2019-12-10 18:13:37
问题 I wanted to use a UITableView which contained static cells with a UITextField inside attached to my LoginViewController . I have added IBOutlets in the header file that correspond to the UITextFields in the storyboard. Unfortunately Xcode does not allow static content inside a UITableView you need to use a UITableViewController . Therefore I split out the UITableView from the storyboard and used a ContainerView to embed a UITableViewController which works well. Attached a screenshot of the

Access an IBOutlet from another class in Swift

爱⌒轻易说出口 提交于 2019-12-10 16:36:57
问题 I'm new to Swift and Mac App. So I'm writing an Mac App today and I still confuse how to access an IBOutlet from another class after searching a lot. I'm using StoryBoard and there are two NSTextField path mirror in my ViewController. I have created a custom class Path.swift for the first NSTextField path to know when the text in path has changed. class Path: NSTextField, NSTextFieldDelegate { override func drawRect(dirtyRect: NSRect) { super.drawRect(dirtyRect) // Drawing code here. self

Why does Xcode create a weak reference for an IBOutlet? [duplicate]

人盡茶涼 提交于 2019-12-10 12:14:23
问题 This question already has answers here : Should IBOutlets be strong or weak under ARC? (11 answers) Closed 5 years ago . I notice when i create a outlet within a story board it generates the following code __weak IBOutlet UILabel *mLabel; . Why is it declaring it as a weak pointer? From my understanding, when the object gets released, all its members will get released too. In most of my code I'm declaring the outlets as strong pointers. Is this going to create problems? 回答1: According to iOS

iOS Memory Management Issue

空扰寡人 提交于 2019-12-10 11:56:42
问题 When you use Xcode's feature and drag from the nib file into the .h and .m file, Xcode adds the code in the dealloc and viewDidUnload . It adds extra code I do not normally add. I am just curious if this extra code is needed. I would have done [self setDisplaySlider:nil] and not disp = nil and [disp release] . Is this necessary? I don't think you have to release disp. @interface ViewController : UIViewController { IBOutlet UISegmentedControl *disp; } @property (retain, nonatomic) IBOutlet