nib

How exactly does an NSView, an NSViewController, and MainMenu.xib fit together?

社会主义新天地 提交于 2019-12-04 15:18:16
I'm going to cut right to the chase: my application has grown quite a bit, and now I think it's time for me to do some tidying up. I want to separate some of my views from my MainMenu.xib file into their own Nib file. The part that's tripping me up is the whole "Interface Builder + My Code" thing. Here's what I've done so far: I've added a view controller proxy object: In the Identity inspector, I've added my view controller's class name to the Custom Class field. In the Attributes inspector, I've entered the name of the Nib I want to load up. I've connected the view controller object's view

Load (and display) a .XIB from the web

南笙酒味 提交于 2019-12-04 15:11:34
I want to be able to download (via a NSURLConnection request) a .XIB file, and have it presented in a view. I have implemented the NSURLConnection, and surely enough, when the connection completes, I am left with a NSString of XML data representing the XIB file. Example: (just the first few lines of many) <?xml version="1.0" encoding="UTF-8"?> <archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10"> <data> <int key="IBDocument.SystemTarget">800</int> <string key="IBDocument.SystemVersion">10D573</string> <string key="IBDocument.InterfaceBuilderVersion">762</string> <string

NSInternalInconsistencyException', reason: 'Could not load NIB in bundle while fetching 500+ records from the address book database

橙三吉。 提交于 2019-12-04 14:56:01
I am sorry if this question is getting repeated, but I could not help it since I have tried every possible solution but nothing worked and hence I am asking this question. I am loading almost 500 records in my table view from the address book database at one go. If the records are few ,say 50 or 100, my table is displayed without any problem. But when the number of record goes say 300+, I get a crash which says: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle (loaded)' with name 'GroupmemberCell'' I have read

Should an outlet to a view controller class be weak or stong? OSX app

你。 提交于 2019-12-04 14:52:30
Here's what i did. Make a clean OSX project. went to main.xib and dragged a popover controller. This created 2 visible objects on on interface builder. I went to the appDelegate.h file and did `-@Property ( assign ) IBOutlet NSViewController *popVC; Then i went to the applicationDidFinishLaunching: method and did popVC = [[NSViewController alloc] init]; Result: I get the following error message: Shouldnt objects on a nib be weak since it is already owned by the nib? Outlets to view controllers should be strong . The NIB doesn't own the objects, its just an archive. Outlets to views should

Best pratice between storyboard xib/nib pure programming [closed]

允我心安 提交于 2019-12-04 13:12:15
Closed . This question is opinion-based. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it can be answered with facts and citations by editing this post . Closed 6 years ago . Being new to ios programming, I started of course with storyboard then I have read that it has its limitation when multiple developer comes to work on the same app, so I switched to pure code. But I guess xib / nib might be a good compromise. Can you give me a more mature point of view? Thanks a lot for your lights I'd vote against using storyboards. They're just

How to unit tests a private or internal function in Swift?

十年热恋 提交于 2019-12-04 10:29:37
So I created a custom an abstract class who inherit from UIViewController (Inherited by RebloodViewController) class named MainViewController. In this class I write a reusable nib registration function class MainViewController: RebloodViewController { typealias Cell = RebloodViewController.Constants.Cell internal func registerNib(_ cellNib: Cell.Nib, target: UICollectionView) { let nib = UINib(nibName: cellNib.rawValue, bundle: nil) do { let identifier = try getCellIdentifierByNib(cellNib) target.register(nib, forCellWithReuseIdentifier: identifier) } catch { fatalError("Cell identifier not

Xib for iPhone and iPad

馋奶兔 提交于 2019-12-04 10:10:14
I have a Xib for iPhone and I need a similar view for iPad, only iPad size. What is the best way of doing this? Can you put both views in the same Xib and somehow specify which one is shown? Or do I need to be make 2 Xib files and 2 classes? I ended up using 1 class. I set the file owner of both XIB files to this same class. I just used the name of the XIB file So I have 2 xibFiles, iPadXib.xib and iPhoneXib.xib NSString *nibFileName = (iPadVersion) ? @"iPadXib" : @"iPhoneXib"; ViewControllerName *vc = [[ViewControllerName alloc] initWithNibName:nibFileName bundle:nil]; Or do I need to be make

Load XIB into ViewController Xamarin?

社会主义新天地 提交于 2019-12-04 09:26:20
It is possible to create and load view from a custom XIB in xamarin? In Objective-C is like: self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil]; self.window.rootViewController = self.viewController; 1 - Create your XIB file (example MyView). 2 - In the .cs related to the XIB file add this static creator method: partial class MyView : UIView { public MyView (IntPtr handle) : base (handle) { } public static MyView Create() { var arr = NSBundle.MainBundle.LoadNib ("MyView", null, null); var v = arr.GetItem<MyView>(0); return v; } } 3 - Add MyView to the

UIViewController with Nib File and Inheritance

左心房为你撑大大i 提交于 2019-12-04 07:14:47
I'm trying to do something really tricky and I'm still stuck at a point. I'm attempting to instance an UIViewController with a Nib file inherited from an other UIViewController with an other Nib file. The problem is when I instantiate my son UIViewController . // SonViewController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { // Custom initialization. } return self; } The init method initWithNibName:bundle: should call the super class but it only call its own nib file. In the super

Iphone Orientation and 2 Nib Files

对着背影说爱祢 提交于 2019-12-04 05:52:16
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{ [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:duration]; if(portrait) { [