nib

Is there a pre-iOS 4 replacement or workaround for UINib?

走远了吗. 提交于 2019-12-25 04:57:06
问题 My application features a tableview which contains some rather complex tableviewcells. Therefore, these cells have been designed in Interface Builder and are instanciated later as needed using UINib which allows just that - load the content from a nib and instanciate it as needed. But UINib is only available for iOS 4.0 and above. Before I go ahead and abandon all the 3.x users, is there a way to (easily) recreate what I'm doing using pre-iOS4 classes and methods? Thanks alot!! 回答1: You can

Changing an Object in UITableViewCell is also changing the Object of a reused UITableViewCell

China☆狼群 提交于 2019-12-25 04:31:31
问题 Code updated to working version. Thanks again for the help :) Hey guys. I have a UITableViewController set up to use a custom cell loaded from a nib. Here's my cellForRowAtIndexPath: // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSString *cellIdentifier = @"PeopleFilterTableViewCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; if (cell == nil)

UIViewController initWithNibName results in nil view

帅比萌擦擦* 提交于 2019-12-24 20:20:48
问题 I'm trying to make a view controller that will always load the same nib. My initialization code looks like this: -(id)init { NSString* nibName; if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) nibName = @"XIB_iPad"; else nibName = @"XIB_iPhone"; self = [super initWithNibName:nibName bundle:nil]; if (self) { ... } return self; } - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { return [self init]; } The problem is that this code results in the view

My custom UIView dos not receive touches

感情迁移 提交于 2019-12-24 05:39:28
问题 Using IB, I have created a small subview that contains a few buttons. My controller reads the small view from the xib-file and adds it as a subview to the main view. It loads okay, I can see the subview and all its buttons. As far as I can see, It does also connect to the IBOutlets and IBActions in the controller. However, when I press a button nothing happens! In fact, when I press a button the super view's touchesBegan is invoked! The super view does also contain an "ordinary button" (i.e.

NSWindowController: loadWindow loads window from nib but showWindow: does nothing

我的未来我决定 提交于 2019-12-24 01:19:58
问题 I have an NSWindowController subclass called _PreferencesWindowController with the following implementation - @synthesize window; - (id)init { self = [super initWithWindowNibName:@"PreferencesWindow"]; if (!self) return nil; return self; } And I tried to show the window in _PreferencesWindowController by using the following code - _preferencesWindowController = [[_PreferencesWindowController alloc] init]; [_preferencesWindowController showWindow:nil]; It does nothing, and I checked

How do I set my nib File's Owner to an object in another nib file?

匆匆过客 提交于 2019-12-23 23:59:26
问题 I'm new to Cocoa and am having trouble splitting my nib file into multiple nib files. My MainMenu.nib contains a Tracker Controller object, which is a subclass of NSObject . It has an outlet to a Show Tracker menu item in my main menu. My TrackerWindow.nib has the File's Owner class set to TrackerController , and has outlets to the window and view in that nib file. I'm not sure how to make the File's Owner of the second nib be a proxy for the instantiated TrackerController in the first nib.

UITableView load a Custom Cell from NIB file throws NSInternalInconsistencyException

南笙酒味 提交于 2019-12-23 21:12:01
问题 In an ios application I have a UITableView. In the cellForRowAtIndexPath method I need to return a custom cell using it's NIB name. For that I use loadNibNamed . (I will fill the data in the cell after the load in the 'willDisplayCellforRowAtIndexPath') MyItemCell is a XIB file (MyItemCell.xib) that containg 2 UIImageView and a UIButton (Each item has a tag) This is my code: In my viewController - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *

Reusable bits of interface, designed in IB

纵然是瞬间 提交于 2019-12-23 02:21:30
问题 I'm making an app that includes the same group of buttons in many different contexts. The buttons send their actions to a different object in each context. I'd like to be able to design a single NSView in IB containing the buttons, and then be able to put copies of that view in many places in my nibs, while maintaining the link, so changes propagate. I'd like to connect each of those instances to different objects, and have the buttons send their actions to whatever object their parent view

How to add app delegate back to mainwindow.xib

对着背影说爱祢 提交于 2019-12-22 13:07:09
问题 short answer: drag a Object from Object library and set its class to delegate. Details see the answer below. I accidentally removed app delegate from mainwindow.xib. I looked into everywhere but still cannot find a way to add it back. I tried to find it online and still got no result. Can anyone help me to fix it? Thank you. My project Other's project Main.m #import <UIKit/UIKit.h> int main(int argc, char *argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, nil); } } 回答1:

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

好久不见. 提交于 2019-12-22 04:42:51
问题 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