nib

Subclassed UIView from NIB File not typed to subclass

不想你离开。 提交于 2019-12-05 11:48:30
I have a NIB file, with some class (SomeClassView : UIView) set as the custom class of the top level view of the NIB. SomeClass has IBOutlets that I use to hookup subviews of SomeClass that I lay out in Interface Builder. I instantiate SomeClass like this: - (id)initWithFrame:(CGRect)frame { self = [[[[NSBundle mainBundle] loadNibNamed:@"SomeClassView" owner:nil options:nil] objectAtIndex:0] retain]; // "SomeClassView" is also the name of the nib if (self != nil) { self.frame = frame; } return self; } Now say I subclass SomeClass with SubClassView. I add a method to SubClassView called -(void

Swift 3 Load xib. NSBundle.mainBundle().loadNibNamed return Bool

孤者浪人 提交于 2019-12-05 04:49:06
I was trying to figure out how to create a custom view using xib files. In this question the next method is used. NSBundle.mainBundle().loadNibNamed("CardView", owner: nil, options: nil)[0] as! UIView Cocoa has the same method,however, this method has changed in swift 3 to loadNibNamed(_:owner:topLevelObjects:) , which returns Bool , and previous code generates "Type Bool has no subscript members" error, which is obvious, since the return type is Bool. So, my question is how to a load view from xib file in Swift 3 First of all the method has not been changed in Swift 3 . loadNibNamed(_:owner

why does the init-method of a custom nib-based table cell not get called

若如初见. 提交于 2019-12-05 04:36:41
I have a nib-based table view cell which I created in Interface builder. I set the class of the table view cell to FooTableViewCell which extends from UITableViewCell . In FooTableViewCell I override the init method like this: -(id)init{ if ((self = [super init])){ // My init code here } return self; } I now expected that my gets called, when it is being instantiated. However the table view gets displayed but the method is never called. I could work around this but I would like to fully understand it and for me it's not clear how an object can come to live without the init method being called.

Error when validating iOS App

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 02:07:47
I am trying to publish an iOS application, however I receive these error when I try to validate my build: Nib file 'Main-iPad~.nib' was not found. Please ensure the specified file is included in the bundle with any required device modifiers appended to the filename Invalid Info.plist: The Info.plist may contain either UIMainStoryboardFile or NSMainNibFile, but it must not contain both keys. For more information, refer to the Information Property List Key Reference. It seems you have some stale entry in your Info.plist. Inspect it and delete the "Main nib file base name". Also make sure the nib

How to compile a .nib file

∥☆過路亽.° 提交于 2019-12-05 01:39:26
问题 If I'm editing a nib file that I decompiled ( https://github.com/akahan/Nib-Decompiler ) from an application, how do I re-compile it into the original uneditable nib format so that I can put it back into the application? 回答1: Use ibtool. The command line should be something along the lines of: ibtool --compile output.nib input.nib (Yes, output before input; the output name is the argument to the --compile flag, while the input name is ibtool 's direct object argument.) You may need other

iOS - UIActivityIndicator causing “Hides when stopped but is neither hidden or animating” warning

戏子无情 提交于 2019-12-04 23:52:08
I'm getting this warning for every nib file that contains a UIActivityIndicator . The warning states: Unsupported Configuration: Hides when stopped but is neither hidden or animating What am i doing wrong? This means, You have set Hides when stopped . So there must be two states only, Hidden Animating But you have set neither Hidden nor Animating. See the image: It must be Hidden or Animating , If you have Checked Hides when stopped . You have selected hide when stopped option but you are never hiding activityindicator. set you setting as in attached image 来源: https://stackoverflow.com

Why doesn't initWithNibName work for my UIViewController subclass?

我只是一个虾纸丫 提交于 2019-12-04 23:38:33
I have subclassed UIViewController into a new class, PageViewController (I'm writing a simple book app). I want to add a new view loaded from a nib file and am using the following code. It works. PageViewController *viewController1 = [[UIViewController alloc] initWithNibName:@"Page1" bundle:nil]; [viewController1.view setUserInteractionEnabled:YES]; [self.view addSubview:viewController1.view]; However, the first line is wrong because I should be calling alloc on PageViewController. When I correct it (below), the code compiles but the xib file doesn't load and the view is just transparent.

How do you handle memory management of outlets in the iPhone SDK

和自甴很熟 提交于 2019-12-04 21:46:58
Since KVC is used to set outlets on the iPhone, there are 2 methods (that I know of) to make sure you've properly handled memory management. Specifically, I am referring to this article written by Aaron Hillegass. My question is which method do you use and what is your reasoning? Release all your outlets in dealloc and viewDidUnload (Make sure you set them to nil in viewDidUnload.) Make your outlets weak references Personally, I am leaning towards using weak references as it seems cleaner. I go with weak references. As you say its less cluttered and makes an already overly verbose code

Xcode 4.5: Getting error “loaded the nib but the view outlet was not set”

心已入冬 提交于 2019-12-04 18:53:33
After updating to Xcode 4.5 beta I have this error. I don't get the same error if I run the project by Xcode 4.3.3. 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "LocationList" nib but the view outlet was not set.' "LocationList" is a custom cell and the owner is a subclass of UITableViewController. I tried to subclass it to UIViewController and connect it to "view" in IB but then it doesn't recognize [self.tableview reloadData]; I had the same issue and what I did was just overriding the loadView method. So weird new Xcode cannot

Loaded nib but the view outlet was not set - Swift edition

99封情书 提交于 2019-12-04 16:52:43
问题 I have a project that is all in Objective C, except for my view controller, which is in Swift. When I run it, i get the error Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "..." nib but the view outlet was not set.' So I opened up my nib file, look at "File's Owner", and I see that the view does not even show up as an outlet at all. For my old view controller (objective c), the view outlet