nib

Could not cast value of type UIView to [CustomView] using Xib

◇◆丶佛笑我妖孽 提交于 2020-11-29 10:14:15
问题 I've seen a number of similar questions, but many aren't up-to-date, and none have fixed my issue. I have a custom Xib and class, CardView . When I try to instantiate it in code, I get Could not cast value of type 'UIView' to 'CardView' . Class is as follows: class CardView: NibView { @IBOutlet var contentView: UIView! @IBOutlet weak var wordLabel: UILabel! @IBOutlet weak var flipButton: UIButton! @IBOutlet weak var playButton: UIButton! override init(frame: CGRect) { super.init(frame: frame)

my custom framework crashing 'Could not load NIB in bundle

ε祈祈猫儿з 提交于 2020-08-10 20:11:47
问题 I have a custom framework which includes one xib and a UIView class for the same. when I connect my test app with the framework, it got crashed *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </private/var/containers/Bundle/Application/10A66571-E4BA-4C82-BDCE-82DA8018CA1C/cam.app> (loaded)' with name 'scanner'' *** First throw call stack: (0x1b318bab0 0x1b2ea5028 0x1b307b2fc 0x1b6efbb4c 0x1b6efc9e4 0x104902338

NSArrayController initialization

你。 提交于 2020-05-09 19:52:26
问题 I am having trouble getting an core-data backed NSArrayController to work properly in my code. Below is my code: pageArrayController = [[NSArrayController alloc] initWithContent:nil]; [pageArrayController setManagedObjectContext:[self managedObjectContext]]; [pageArrayController setEntityName:@"Page"]; [pageArrayController setAvoidsEmptySelection:YES]; [pageArrayController setPreservesSelection:YES]; [pageArrayController setSelectsInsertedObjects:YES]; [pageArrayController

Presenting a NIB Modally Crashes on iOS 8 but not on iOS 9+

烈酒焚心 提交于 2020-01-26 04:15:43
问题 I have created a NIB which has a name of SomeViewController and all the corresponding code are correct and all the views are bound correctly, but somehow the code self.presentViewController(SomeViewController(), animated: true, completion: nil) causes a crash: fatal error: unexpectedly found nil while unwrapping an Optional value What is the problem? 回答1: To fix this we need to version check by doing this if #available(iOS 8, *) { self.presentViewController(SomeViewController(nibName:

Deleting rows from a static UITableView at runtime

我怕爱的太早我们不能终老 提交于 2020-01-24 13:11:51
问题 Is it possible to delete rows from a UITableView at runtime when all of the sections and rows are defined statically in a nib? In the following storyboard scene, can I delete the "Addr 2" field at runtime? In this case I have not provided a data source to the UITableView . 回答1: I don't know about "delete" but you can hide the row using tableView:heightForRowAtIndexPath: . - (void)methodToToggleAddr2CellVisibility { self.addr2CellIsHidden = !self.addr2CellIsHidden; [self.tableView beginUpdates

Deleting rows from a static UITableView at runtime

跟風遠走 提交于 2020-01-24 13:11:12
问题 Is it possible to delete rows from a UITableView at runtime when all of the sections and rows are defined statically in a nib? In the following storyboard scene, can I delete the "Addr 2" field at runtime? In this case I have not provided a data source to the UITableView . 回答1: I don't know about "delete" but you can hide the row using tableView:heightForRowAtIndexPath: . - (void)methodToToggleAddr2CellVisibility { self.addr2CellIsHidden = !self.addr2CellIsHidden; [self.tableView beginUpdates

Iphone Orientation and 2 Nib Files

↘锁芯ラ 提交于 2020-01-22 20:00:09
问题 I am trying to make an app where each view controller (.h/.m) has 2 NIB files... one for portrait, one for landscape. Is this the "standard" way of supporting orientation or must I manually set up the orientation view programmatically? The problem I am facing is that when a user flips the orientation, all views are reset (so the user must re-enter text fields/views input). Here is my orientation method: - (void) changeTheViewToPortrait:(BOOL)portrait andDuration:(NSTimeInterval)duration{

Xcode - one nib, two classes - outlets in second class not connecting?

蓝咒 提交于 2020-01-17 06:32:16
问题 I've got a single nib file and want to connect some elements to methods in one class (which is the AppDelegate) and some to another class (which is just an NSObject). So the schema looks like this buttonOne -> [mainClass set] buttonTwo -> [auxCalss set] textFieldOne -> mainClass.field textFieldTwo -> auxClass.field The two [set] actions are connected to the two classes and work fine, but only textField one is connected to mainclass, which is also the AppDelegate. TextFieldTwo doesn't work

Xcode - one nib, two classes - outlets in second class not connecting?

ε祈祈猫儿з 提交于 2020-01-17 06:32:00
问题 I've got a single nib file and want to connect some elements to methods in one class (which is the AppDelegate) and some to another class (which is just an NSObject). So the schema looks like this buttonOne -> [mainClass set] buttonTwo -> [auxCalss set] textFieldOne -> mainClass.field textFieldTwo -> auxClass.field The two [set] actions are connected to the two classes and work fine, but only textField one is connected to mainclass, which is also the AppDelegate. TextFieldTwo doesn't work

How to make a custom MKAnnotationView with XIB

白昼怎懂夜的黑 提交于 2020-01-14 01:36:07
问题 I want to have a custom MKAnnotationView. I've created a xib file in IB and set its class to MyAnnotationView. class MyAnnotationView: MKAnnotationView { override init(annotation: MKAnnotation?, reuseIdentifier: String?) { super.init(annotation: annotation, reuseIdentifier: reuseIdentifier) } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } @IBOutlet weak var textLabel: UILabel! @IBOutlet weak var busIcon: UIImageView! } Here's how the xib looks