TableViewController in a separate XIB

Hello ppl,
I am putting down an interface using IB and I'm having a few issues separating the interface into several xib files. I will explain what I need to do in detail.
MainWindow.xib - main xib file, where I have a viewController defined. This view controller has two buttons, and an empty area where a table view needs to be displayed.
TableView.xib - this xib has a tableviewController defined, which includes the table that needs to be displayed in the empty area of the viewController.
What I need done is to put down the connections and settings in IB so that when the viewController loads, it automatically loads the TableView.xib and its corresponding TableViewController.
The problem is, I cannot add a tableViewController inside my viewController and set its properties. Any ideas and how to do this?
Thanks

gonna rephrase this question

Similar Messages

  • TableViewController in a separate xib file

    Hi guys,
    I am having some trouble with IB and connections and would greatly appreciate any help in this matter. I will explain what I am trying to do in detail.
    - In my MainWindow.xib, I have a viewController that presents several UI elements, and has an area reserved for a table view.
    - In a separate TableView.xib, I have a table view controller that defines and operates on the table that should be displayed within the viewController mentioned previously.
    I need to associate the designated region in my UI inside viewController with the tableViewControllers table inside the other xib file. I need detailed steps of to do in my initial view, and what objects to set appropriately to achieve this result.
    Thanks again for any help you can provide.
    James

    gonna rephrase this question

  • Separate XIB for UITabBarController?

    I want to add a UITabBarController view to my window, after it has been running for a while (when a user pushes a button in my game). Adding a UITabBarController to the same xib as the window dwells in is easy. The thing is that I don't want an instance of the tab bar until the user pushes the button (mostly because I don't know what data the tab bar controllers should have until the user pushes that button).
    So I thought that maybe I could use a separate xib for the UITabBarController (preferably I want to use xib instead of code), that I can instantiate in code when the time comes. This proved to be a lot harder than I thought. I've tried making the File Owner of the XIB to a UITabBarController, and then add a tabbar and controllers, but it doesn't look like Xcode puts these things together automatically as when you add a UITabBarController explicitly from the library. So then I tried making the file owner to an UIViewController instead, add a UITabBarController, and then add that controller's view to the UIViewController's view. This kinda worked. It is easy to customize (which is why I want to use XIBs), but unfortunately, the tab bar's buttons don't work to 100%. Only the upper 50% of the buttons are tappable. Beneath, nothing happens if you tap, which isn't acceptable. Is this a bug? Or are you not allowed to add UITabBarControllers to subviews of window?
    Any ideas how I can achieve what I want, preferably using XIBs?
    You can see the "bug" here:
    http://dl.getdropbox.com/u/608462/TabBarTest.zip

    rawgrarr wrote:
    ... are you not allowed to add UITabBarControllers to subviews of window?
    Correct. The tab controller's view must be the root view. From The Views of a Tab Bar Controller in the +UITabBarController Class Reference+:
    Because the UITabBarController class inherits from the UIViewController class, tab bar controllers have their own view that is accessible through the view property. When deploying a tab bar interface, you must install this view as the root of your window. Unlike other view controllers, a tab bar interface should never be installed as a child of another view controller.
    Any ideas how I can achieve what I want, preferably using XIBs?
    Yes. Please take another look at the 3 workarounds listed here (same link I posted in your previous thread on this topic): [http://discussions.apple.com/thread.jspa?messageID=10002001&#10002001].
    From what you've said so far, I think you might want no. 1 from that list. To implement that solution, start with the Tab Bar app template (or any project with a similar MainWindow.xib). Next make a controller subclass and a matching xib (UserInterface->View XIB template) for your starting screen (don't forget to set File's Owner to your subclass, then connect its view). Then, in the @implementation of the app controller, code something like this:
    // MyProjAppDelegate.m
    #import "MyProjAppDelegate.h"
    #import "StartingViewController.h"
    @implementation MyProjAppDelegate
    @synthesize window;
    @synthesize tabBarController;
    - (void)applicationDidFinishLaunching:(UIApplication *)application {
    UIViewController *firstVC = [tabBarController.viewControllers
    objectAtIndex:0];
    StartingViewController *modalVC = [[StartingViewController alloc]
    initWithNibName:@"StartingView" bundle:nil];
    NSLog(@"appDidFinishLaunching: firstVC=%@ modalVC=%@", firstVC, modalVC);
    // Add the tab bar controller's current view as a subview of the window
    [window addSubview:tabBarController.view];
    [firstVC presentModalViewController:modalVC animated:NO];
    [modalVC release];
    Finally, this method, added to the starting controller @implementation, brings up the first tab bar screen when the user is done with the starting screen:
    // StartingViewController.m
    #import "StartingViewController.h"
    @implementation StartingViewController
    - (IBAction)done {
    [self.parentViewController dismissModalViewControllerAnimated:YES];
    Things get slightly more complicated if the user can navigate to other starting views before going to the tab bar screen, so let us know if you have any problems with that control structure.
    Hope that helps!
    - Ray

  • TabViewController to - NavigationViewController to - TableViewController

    Hi. I am trying to make an applicaton that follows the following structure and I am trying to make sure I have it laid out right...
    I have a tab bar controller as the project type... I have added new "tabs" as navigation controllers and view controllers so that when pressing on a tab you will see a static view (such as for settings) and for other tabs you will be able to navigate from screen to screen.
    Most if not all of the screens will use a TableView. My program should flow something like..
    Tab 1
    --List of items
    ----List of properties of selected item (tool bar displays instead of tab bar)
    ------View of details of selected item properties (tool bar displays instead of tab bar)
    Tab 2
    --TBD (similar to tab 1)
    Tab 3
    --TBD (similar to tab 1)
    Tab 4
    --TBD (similar to tab 1)
    Tab 5
    --List of settings
    and here is the structure I have laid out in IB
    MainWindow...
    Tab Bar controller
    --Navigation Controller one
    ----View Controller (one)
    --View Controller (five)
    Each view is linked to a separate xib file with its own view.
    Currently each seperate file is simply a view with text to test that it is working...
    I would like to make most of them Table Views.
    So my question is... how to I go from Tab Bar controller to a table view that will drill down to more views? Most views after the first level will be made programatically based on data pulled in.
    Should each xib file contain a table view controller? should there be seperate navigation controllers for each tab button that points to the table view controllers? or do I not need a navigation controller at all and just have each item in the tab bar be a table view controller?
    Thanks.

    Someone please help me...
    I need to create a tab bar that can drill down into seperate tables and ditch the tab bar on the second level..... I have looked the elements example but its all done programatically... I need to do at least some of it in IB....

  • DidSelectRowAtIndexPath causes my app to crash

    Hi,
    I'm just learning Cocoa. I've implemented a tab bar, and the first view (a UIViewController) contains a table view. I've implemented a separate class as the tableview datasource and delegate. Everything works fine, until I add either didSelectRowAtIndexPath or accessoryButtonTappedForRowWithIndexPath. Even if these methods have absolutely no code in them, just adding their implementation to my delegate creates a problem: when I click on a table row or on the disclosure button, my app breaks, and when I "step into" the code, it crashes with a “EXCBADACCESS”. I do not have any symbolic breakpoints defined.
    Here's the error I see in gdb:
    Loading program into debugger…
    GNU gdb 6.3.50-20050815 (Apple version gdb-962) (Sat Jul 26 08:14:40 UTC 2008)
    Copyright 2004 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License, and you are
    welcome to change it and/or distribute copies of it under certain conditions.
    Type "show copying" to see the conditions.
    There is absolutely no warranty for GDB. Type "show warranty" for details.
    This GDB was configured as "i386-apple-darwin".warning: Unable to read symbols for "/System/Library/Frameworks/UIKit.framework/UIKit" (file not found).
    warning: Unable to read symbols from "UIKit" (not yet mapped into memory).
    warning: Unable to read symbols for "/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics" (file not found).
    warning: Unable to read symbols from "CoreGraphics" (not yet mapped into memory).
    Program loaded.
    sharedlibrary apply-load-rules all
    Attaching to program: `/Users/Beth/Library/Application Support/iPhone Simulator/User/Applications/24242BF8-FA78-4360-A519-593EC497D8CE/NDQ.app/NDQ', process 237.
    Program received signal: “EXCBADACCESS”.
    I currently suspect one of two things, but honestly, have no idea what is causing the problem. I suspect that either, because I'm not using a Navigation controller, it's looking for a stack, but not finding one. Or I haven't hooked something up right in IB.
    As I mentioned, the table is working fine without these method implementations - that is, it is displaying some simple string data and without those method implementations, I can click on a table row and of course, nothing happens, but it doesn't crash.
    Thanks so much in advance for any help.
    Elisabeth

    Elisabeth Freeman wrote:
    I've made a lot of progress since I last posted!
    I can see that!!
    I have set the View Controllers property (using IB) to the Navigation Controller (topicsTableNavController in the code below) for the first tab.
    Neither your code nor your IB conections should set the navigationController property of a view controller. That property is set by the nav controller when the vc is pushed onto its stack. Your code can then use the property to get the nc's address when it wants to push another vc onto the stack.
    Then, I have set the view (through IB) of the Navigation Controller to the Table View Controller.
    Similarly, you should normally consider nc.view to be read only. The nc's view content is a composite of the nav bar and the top vc's view. It's managed by the nc, so neither your code nor your IB connections should change nc.view.
    I think you've simply made a wrong (and very common!) assumption about the relationship between a nav controller and the view controllers it manages: The nc's view is the one that needs to be added to the hierarchy (the tab view in this case). The vc's view is then added to the nc's view, not the other way around. So when we visualize the relationship, the nav controller is always the parent of the view controllers that are pushed on and popped from its stack.
    Since you defined your controllers and their connections in IB, the solution you're looking for is in the xib file, not your code. It turns out that IB already knows the correct structure, so it's deceptively easy to build it. That can make it harder to learn what's going on, so you're lucky you managed to scramble the stucture this time, else you might have never learned it.
    Try building a new test bed in IB as follows:
    1) File->New Project->iPhone OS->Application->Tab Bar Application;
    2) Open MainWindow.xib in IB and bring up the window named MainWindow.xib (Window->Document);
    3) Switch View Mode (upper left corner) to the center position (2 columns with small-icon tree view to the left);
    4) Expand Tab Bar Controller and select (not expand) the first View Controller so it's highlighted in blue;
    5) Delete the first View Controller by pressing the Delete key or Edit->Delete while that controller is highlighted;
    6) Drag a Navigation Controller to the MainWindow.xib tree (Tools->Library->Objects->Controllers);
    7) Position the nav controller over the tab bar controller icon until the tbc is shaded and outlined;
    8) Drop the nc so that the tbc becomes its parent--i.e. the nc takes the place of the deleted vc;
    9) Expand the nc and expand its child root controller to see the structure;
    10) Select the root vc, open the Attributes panel (Tools->Attributes Inspector) and enter a title for the root vc;
    11) If you want to define the root vc's view in it's own xib, enter a name for the new xib;
    12) else you can now drag a view (e.g. UIView or UITableView from the library onto the root vc's icon;
    13) If you want the root vc to be a UITableViewController. go back to step 10 and replace the root UIViewController;
    14) After you have the structure you want, right click on each icon to see the connections IB has already made.
    Btw, if you decide to make a separate xib in step 11, make sure you set the controller's class id in both MainWindow.xib and the new xib. I.e. both the icon that creates the controller and its proxy need to have the same class (else you get a very common crash).
    I'm counting on you to let me know if the above is as clear as mud, ok? I've recently tried to help in two other threads that involved the same misunderstanding about nav controllers. Start reading each of these threads at the quoted paragraph:
    The reason your current code isn't producing the transition you expect is that the tab bar has attached the table controller's view to the hierarchy (i.e. using addSubview) instead of the nav controller's view. You want the nav controller's view because that's the one which will change when you push a new controller. [http://discussions.apple.com/thread.jspa?messageID=9592005&#9592005];
    It's the nav controller's view that contains the content view, not the other way around. This point is worth taking a moment to see, and it seems to be commonly misunderstood. [http://discussions.apple.com/message.jspa?messageID=9607946#9607946].

  • How-to set the title of  a View

    Hi,
    I'm a very newbie of Obj-C and InterfaceBuilder.
    From three days I'm fighting with my iPhone app to set the title of a view.
    I've the MainWindow.xib with a UITabBarController; each tabbar's viewcontroller is on a separate xib (i.e.: the GUI of every button of the tabbar is on a different xib file).
    In IB I set up the top bar property to Translucente etc... In Xcode, in the viewDidLoad I set the self.title to something... but the top bar is never shown!!
    I also tried to set self.navigationItem.title... but nothing...
    To see the top bar do I have to use a NavigationController inside every "button" of the tab bar?? Or is the top bar property of IB not working??
    Thanks to all...

    Wenwen,
    View Function dropdown "standard view" is just making the ALV to display the ALV standard configuration (so it will display the ALV the way is designed).
    now if you want to change that to your OWN VIEW you just need to click in the SETTINGS (ALV TOOLBAR at the right end) and then configure your ALV the way you want to be display. After that click SAVE AS and you can name the VIEW to your own and also you can click INITIAL VIEW checkbox in order to display always that for youl.
    Please note that this is a user base personification so this will be only available for you.
    if you want to have your own view for every user then you need to enhanced the ALV in a POST-EXIT method and do not allowed user personification.
    you can disable user personification at the application level in the parameters tab.
    hope this help!
    Jason PV

  • Tab bar application and UIScrollView

    Hi Everyone,
    I am creating a tabbar application.
    I have 5 tabs already setup, and now one of the tabs needs a few more fields appended to the bottom of the view.
    I am using a single NIB file with all the views built inside of it.
    What I need to do is take the second tab and add a UIScrollView to it, so I can add the additional fields to the bottom.
    I would like to stick with using IB....
    Here is the stack I have setup, please advise where I would insert the UIScrollView
    App
    First Responder
    App Delegation
    Window
    Tab Bar Controller
    Tab Bar
    Main View Controller (Log)
    Selected Main View Controller (Permit)
    Scroll View
    View
    Tab Bar Item (Permit)
    Main View Controller (Tags)
    Main View Controller (Release)
    Main View Controller (Other)
    I have placed the ScrollView both within the View, and, as shown, a view as a child of the scroll view...
    I have set the height of the view and the scroll view at 800px
    Please advise on what I am missing in this.
    Thanks
    tony

    alt-088 wrote:
    I have all the views loaded within the same XIB file.
    It's usually better to make a separate xib for each view. The most important reason for this is memory management. Firstly, all the views defined in MainWindow.xib are loaded at startup. This means a view will be loaded even if its tab is never selected. Views defined in a separate xib won't be loaded unless and until they're needed.
    It's also much easier to unload a view if its defined in a separate xib, since the view, along with all its subviews, can be reloaded at any time by simply reloading the xib (e.g. by initing a new controller with [initWithNibName:bundle:|http://developer.apple.com/iphone/library/documentatio n/UIKit/Reference/UIViewControllerClass/Reference/Reference.html#//appleref/occ/instm/UIViewController/initWithNibName:bundle:]). This is especially important when the controller receives a low memory warning. For example, the default implementation of [didReceiveMemoryWarning|http://developer.apple.com/iphone/library/documentatio n/UIKit/Reference/UIViewControllerClass/Reference/Reference.html#//appleref/occ/instm/UIViewController/didReceiveMemoryWarning] will unload a view defined in a separate xib because the method knows how to reload that view.
    Another reason for separate xibs is that the main xib needs to be loaded before the app can launch. Anytime you remove an object from MainWindow.xib, you'll reduce launch time.
    should i have a view for each of the tabs in the main form?
    You probably already have a view for each of the tabs, so I assume you meant to ask, "Should i have a separate xib file for each controller which is connected to the tab bar controller in MainWindow.xib?"
    If I restated the question correctly, the answer is yes, as explained above.
    Note the Tab Bar App template demonstrates both ways to define each controller's view. The first view controller's view is defined in MainWindow.xib. The second controller's view is defined in SecondView.xib. The difference between these setups can be seen in the Attributes Inspector. If you select the First View Controller (most easily done in the xib (icon) window if the View Mode switch is in the Center position to display the view hierarchy) and open the Attributes Inspector, you'll see the NIB Name selection is blank. If you then select the Second View Controller, the NIB Name selection will be "SecondView".
    You could move the First View Controller's view to a separate xib by making a new xib named "FirstView.xib" (File->New File..->iPhone OS->User Interface->View XIB), deleting the View object under the First View Controller in MainWindow.xib, and then setting the NIB Name selection in the Attributes Inspector to "FirstView". After that, open FirstView.xib, select File's Owner and set its Class to FirstViewController in the Identity Inspector, then connect the View object to the 'view' outlet of File's Owner.
    You can make a separate xib for any of your views in the same way. Of course in the case of a scrolling view, you would add a UIScrollView object and connect it to the 'view' outlet of File's Owner, then connect the UIView object to the 'contentView' outlet of File's Owner as discussed previously (after setting the Class of File's Owner to a custom class that has a contentView IBOutlet).
    Whenever you make a separate xib for one of your views, _make sure File's Owner is set to the same class as its parent controller object in MainWindow.xib_.
    \- Ray

  • MVC UIViewController vs UIView advice

    I have an app that I originally built using 4 separate UIViewControllers so that I could have my AppDelegate call the appropriate view controller for the specific layout and view configuration.  It seemed reasonable at the time.
    Now, I want the user to be able to change the layout while running the app, and it doesn't seem to make sense to dismiss the entire view controller to restart the app from the AppDelegate level.
    So, I think I should split the current view controller up into parts, with the base viewController having all the common elements, and then have the variable layouts (which each have a bunch of buttons) as separate UIViews which I just read from a nib file so only one layout is in memory at a time.
    I separated the UIView elements into separate .xib files, but...
    The only problem with that is there doesn't seem to be an way to simply read in a UIView from a nib file to add them to the existing view controller.
    For MVC, it was my understanding that you only have one VC active at a time, so using a separate viewController to read in the appropriate button layout for only one small section of the screen was not appropriate.
    Am I understanding that properly, or is it perfectly fine to have one VC controlling the top and bottom of the screen, a 2nd VC to handle the button layout view on the left side of the screen and a 3rd VC to handle the text display with clipping of the view to show only a portion allowing the main background (controlled by the first VC) to show through?
    Or, if only one can be active, how should I manage the individual views?
    Once this is re-done, I plan to add views for the iPad, and just have to manage the views that are different between the platforms, so whatever mechanism I choose should als work for universal apps.
    Thanks!

    Well, I've done some more research since I posted the question, and  loadNibNamed:owner:options: seems like one method to bring in the individual UIView objects as I started to do early in this update.  (Instead of
    initWithNibName:bundle: )
    The examples in the Resource Programming Guide are a little sparce in this area.
    I presume that once loaded from the nib file, I still need to add the view as a subView.
    Alternatively, would it make the most sense to create my main view nib file including the default view with the button layouts in the default configuration, and then if/when the user selects a different layout, replace the current view with one that I load from the appropriate "alternative" nib file, freeing up the previous UIView object?
    In this instance, the initial layout view will already be part of the subview  structure added with the UIViewController, and I would simply be replacing the existing UIView object with a new one from my alternate nib file.
    Right?

  • [iPhone] Help Needed with 'crash' on Button action handling

    Hi, I've just started testing the water with the iPhone and decided the best way to learn would be to try to create a fairly simple application to switch between screens on a menu when a button is clicked. However I'm having problems handling my 'aButtonHasBeenClicked' action as the program crashes when it attempts to do so.
    I think my problem stems from how I set up my view controllers so before I start posting any code I have a question about how to use them correctly.
    In my Main Application window xib file, created in Interface Builder I have the application delegate object which is linked to a blank Window and an outlet to a class which when instantiated will inherit from UIViewController and load the view controller from a separate xib file (this is instead of having the actual view controller object in the same xib and connecting it up in interface builder)
    The separate xib file contains a view controller and a view with a UIButton whose 'Touch Up Inside' event is linked to an action in the view controller to handle the button click.
    Is this a suitable method to use for the view controller? i.e. instead of having a view controller in the same xib as the application delegate and connecting it to my class outlet in interface builder, should I be able to load the view controller from a separate xib file and still access it from the class outlet in the delegate file? If I should be able to do that, then I'll post more detailed code as it must be some other problem I'm having.
    Btw, what happens with my program is that everything is displayed fine in the simulator but the it hangs when the button is clicked without actually crashing.

    How did you get this working?
    The only way I got this to work, is to wire the actions to the View Class instead of the controller.
    This is not the way this is suppose to work

  • ViewDidLoad method not executing

    I'm using Xcode 3.2 and I have a tabbar project with a few tabs and view controllers. I have inserted code into the secondviewcontroller.m in the provided empty ViewDidLoad method but it's not getting executing.
    I put a breakpoint on the first line and it never gets there?
    Other code in this viewcontroller works fine, awake from nib etc.
    Any idea or what to check for?
    Thanks!

    bluerondo7 wrote:
    I don't have a SecondViewController.xib so maybe this is the problem?
    Ooh.. Well I assumed you started with the Tab Bar Application template. That template starts you off with two tabs. The view controller for the first tab is of type FirstViewController, and its view is defined in MainWindow.xib. The view controller for the second tab is of type UIViewController, and its view is defined in a separate xib named SecondView.xib.
    Your problem seems to be with your xib structure, but this type of problem can take forever to work out in the forum without pictures. Here are some questions that might help us isolate the problem:
    1) Which template did you use to start your project?
    2) If you started with the Tab Bar app template, do you remember at what point you removed SecondView.xib?
    3) Can you describe, step-by-step what you did in MainWindow.xib to create the structure you have now?
    4) Can you post a screen shot of MainWindow.xib on a web site for us to see?
    5) If yes to 4, please set the View Mode switch to the center position and expand all the tree nodes in your screen shot.
    6) If no to 4, please try to describe the two columns of that file in your post. It will be important to show the level of indentation when describing the tree. You can do that by just starting each line with a number, e.g. 1 for top level, 2 for one indent, etc.
    7) For each of your 5 view controllers, please select the view controller in the icon tree and bring up the Attributes Inspector. Any view controller which requires a separate xib will have the name of the xib file in the NIB Name picker field of the Attributes Inspector. If that field is not blank for any of your controllers, let us know.
    \- Ray

  • Help neede with UITableview and detail views

    OK. So I'm new to iPhone dev and have been trying to figure this out with no luck.
    I have a xib and coresponding ProfileViewController file that contains a tableview. The tableview is pulling data from a .txt file. This is working. However, what I'd like to be able to do is when a user selects one of the tableview rows, it pulls a different xib file, under the nav controller.
    For instance:
    Item 1 displays person.xib
    Item 2 displays animal.xib
    etc.
    I am also using a tab view controller and a navigation controller. The tab views and nav controller work fine.
    If anyone could help with some instructions/code, I would greatly appreciate it.
    Thanks,
    Doug

    Hi Doug - Do you just want each row of your table view to switch to a different detail view when selected? That's a fairly standard setup, so maybe you're trying to describe something else I'm not seeing yet.
    Let's start with the standard structure anyway. Then you can explain what you want that's different, ok?
    Have you looked over the UICatalog sample app yet? The main view of that app presents a table view under a nav bar. Selecting any row in the table view will slide the detail view matching that row under the nav bar. Each detail view is controlled by a different subclass of UiViewController.
    The UICatalog sample is a bit more complicated than we might want for learning the basic structure, but I think it's clear enough for you to see the key steps. Here's one of the methods you might want to look at:
    // MainViewController.m
    // the table's selection has changed, switch to that item's UIViewController
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    UIViewController *targetViewController = [[menuList objectAtIndex: indexPath.row] objectForKey:@"viewController"];
    [[self navigationController] pushViewController:targetViewController animated:YES];
    The above is deceptively simple because lots of work has gone into building the menuList array, which is an array of NSDictionary objects, each containing all the info needed to bring up one detail view. However with a little study, you may find most of the answers to your questions in that file.
    Note that while the view controllers in the menuList array are created with code in awakeFromNib, they could just as easily have been pulled out of separate xib files.
    If you''d like a really well paced, crystal clear explanation of how to use nav bars with table views, I would recommend Chapter 8 and 9 of +Beginning iPhone Development+ by Mark and LaMarche. I think you may be right at the point where you'll benefit from that book the most.
    Hope that helps!

  • Mainmenu.xib will not open in a separate window?

    I'm new to developing, and bought the book "Beginning Mac Programming: Develop with Objective-C and Cocoa". I'm only a few pages in, and I've run into a problem. I am running on Snow Leopard and Xcode 3, and when I double-click on "Mainmenu.xib", nothing appears.
    Any suggestions?

    I have the same problem. I'm following the instructions in order to create a HelloWorld routine.
    "Using Interface Builder
    Interface Builder is Apple’s graphical editor that you use to design user interfaces. It doesn’t generate source code; instead it allows you to manipulate objects directly and then save those objects in an archive called a nib file. At runtime, when a nib file is loaded the objects are unarchived and restored to the state they were in when you saved the file.
    You need to add an instance of the HelloView class that you just created in Xcode to the application window.
    Open Interface Builder by double-clicking the MainMenu.xib file, which you can find in the detail view for the project group.
    Note: A nib file can have a .xib extension or a .nib extension. To find out more about the differences between these, see Interface Builder User Guide."
    But when I diuble-click the MainMenu.xib file, it doesn't make anything. What could be the problem?

  • How to determine what goes in the xib list

    How do you know when you need to add a View Controller or a Nav Item, or other classes in the same window that has File Owner and First Responder icons in it.
    I mean I understand I have a View showing and I link it to the File Owner, because the File Owner is the ViewController for that xib. But in what scenarios do you have to add another ViewController, or a TableViewController, of a NavController, or a NavItem or NavBar.
    And I do not mean the MainWindow.xib which has a Window, I mean other new xib files that you create to make the rest of your application.
    Thanks for the help
    Mark

    A general rule of thumb is that you will have a nib for each ViewController. Sometimes a VC is so simple that there is no need to lay it out interactively - these may be implemented entirely in code. In contrast a view may become so complex that you choose to implement some of its subviews in separate nibs.

  • How can I implentate a search bar in TableViewController iOS

    How can I implentate a search bar in my TableViewController? Code:
    //  ViewController.m
    //  Movie List
    //  Created by Damian on 20/02/15.
    //  Copyright (c) 2015 Tika Software. All rights reserved.
    #import "ViewController.h"
    @interface ViewController ()
    These outlets to the buttons use a `strong` reference instead of `weak` because we want
    to keep the buttons around even if they're not inside a view.
    @property (nonatomic, strong) IBOutlet UIBarButtonItem *editButton;
    @property (nonatomic, strong) IBOutlet UIBarButtonItem *cancelButton;
    @property (nonatomic, strong) IBOutlet UIBarButtonItem *deleteButton;
    @property (nonatomic, strong) IBOutlet UIBarButtonItem *addButton;
    // A simple array of strings for the data model.
    @property (nonatomic, strong) NSMutableArray *dataArray;
    @end
    #pragma mark -
    @implementation ViewController
    - (void)viewDidLoad
        [super viewDidLoad];
         This option is also selected in the storyboard. Usually it is better to configure a table view in a xib/storyboard, but we're redundantly configuring this in code to demonstrate how to do that.
        self.tableView.allowsMultipleSelectionDuringEditing = YES;
        // populate the data array with some example objects
        self.dataArray = [NSMutableArray new];
        NSString *itemFormatString = NSLocalizedString(@"Movie %d", @"Format string for item");
        for (unsigned int itemNumber = 1; itemNumber <= 0; itemNumber++)
            NSString *itemName = [NSString stringWithFormat:itemFormatString, itemNumber];
            [self.dataArray addObject:itemName];
        // make our view consistent
        [self updateButtonsToMatchTableState];
    #pragma mark - UITableViewDelegate
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
        return self.dataArray.count;
    - (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
        // Update the delete button's title based on how many items are selected.
        [self updateDeleteButtonTitle];
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
        // Update the delete button's title based on how many items are selected.
        [self updateButtonsToMatchTableState];
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
        // Configure a cell to show the corresponding string from the array.
        static NSString *kCellID = @"cellID";
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellID];
        cell.textLabel.text = [self.dataArray objectAtIndex:indexPath.row];
        return cell;
    #pragma mark - Action methods
    - (IBAction)editAction:(id)sender
        [self.tableView setEditing:YES animated:YES];
        [self updateButtonsToMatchTableState];
    - (IBAction)cancelAction:(id)sender
        [self.tableView setEditing:NO animated:YES];
        [self updateButtonsToMatchTableState];
    - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
        // The user tapped one of the OK/Cancel buttons.
        if (buttonIndex == 0)
            // Delete what the user selected.
            NSArray *selectedRows = [self.tableView indexPathsForSelectedRows];
            BOOL deleteSpecificRows = selectedRows.count > 0;
            if (deleteSpecificRows)
                // Build an NSIndexSet of all the objects to delete, so they can all be removed at once.
                NSMutableIndexSet *indicesOfItemsToDelete = [NSMutableIndexSet new];
                for (NSIndexPath *selectionIndex in selectedRows)
                    [indicesOfItemsToDelete addIndex:selectionIndex.row];
                // Delete the objects from our data model.
                [self.dataArray removeObjectsAtIndexes:indicesOfItemsToDelete];
                // Tell the tableView that we deleted the objects
                [self.tableView deleteRowsAtIndexPaths:selectedRows withRowAnimation:UITableViewRowAnimationAutomatic];
            else
                // Delete everything, delete the objects from our data model.
                [self.dataArray removeAllObjects];
                // Tell the tableView that we deleted the objects.
                // Because we are deleting all the rows, just reload the current table section
                [self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationAutomatic];
            // Exit editing mode after the deletion.
            [self.tableView setEditing:NO animated:YES];
            [self updateButtonsToMatchTableState];
    - (IBAction)deleteAction:(id)sender
        // Open a dialog with just an OK button.
        NSString *actionTitle;
        if (([[self.tableView indexPathsForSelectedRows] count] == 1)) {
            actionTitle = NSLocalizedString(@"Are you sure you want to remove this movie?", @"");
        else
            actionTitle = NSLocalizedString(@"Are you sure you want to remove these movies?", @"");
        NSString *cancelTitle = NSLocalizedString(@"Cancel", @"Cancel title for item removal action");
        NSString *okTitle = NSLocalizedString(@"OK", @"OK title for item removal action");
        UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:actionTitle
                                                                 delegate:self
                                                        cancelButtonTitle:cancelTitle
                                                   destructiveButtonTitle:okTitle
                                                        otherButtonTitles:nil];
        actionSheet.actionSheetStyle = UIActionSheetStyleDefault;
        // Show from our table view (pops up in the middle of the table).
        [actionSheet showInView:self.view];
    - (IBAction)addAction:(id)sender
        [self.dataArray addObject:@"New Movie"];
        // Tell the tableView about the item that was added.
        NSIndexPath *indexPathOfNewItem = [NSIndexPath indexPathForRowself.dataArray.count - 1) inSection:0];
        [self.tableView insertRowsAtIndexPaths:@[indexPathOfNewItem]
                              withRowAnimation:UITableViewRowAnimationAutomatic];
        // Tell the tableView we have finished adding or removing items.
        [self.tableView endUpdates];
        // Scroll the tableView so the new item is visible
        [self.tableView scrollToRowAtIndexPath:indexPathOfNewItem
                              atScrollPosition:UITableViewScrollPositionBottom
                                      animated:YES];
        // Update the buttons if we need to.
        [self updateButtonsToMatchTableState];
    #pragma mark - Updating button state
    - (void)updateButtonsToMatchTableState
        if (self.tableView.editing)
            // Show the option to cancel the edit.
            self.navigationItem.rightBarButtonItem = self.cancelButton;
            [self updateDeleteButtonTitle];
            // Show the delete button.
            self.navigationItem.leftBarButtonItem = self.deleteButton;
        else
            // Not in editing mode.
            self.navigationItem.leftBarButtonItem = self.addButton;
            // Show the edit button, but disable the edit button if there's nothing to edit.
            if (self.dataArray.count > 0)
                self.editButton.enabled = YES;
            else
                self.editButton.enabled = NO;
            self.navigationItem.rightBarButtonItem = self.editButton;
    - (void)updateDeleteButtonTitle
        // Update the delete button's title, based on how many items are selected
        NSArray *selectedRows = [self.tableView indexPathsForSelectedRows];
        BOOL allItemsAreSelected = selectedRows.count == self.dataArray.count;
        BOOL noItemsAreSelected = selectedRows.count == 0;
        if (allItemsAreSelected || noItemsAreSelected)
            self.deleteButton.title = NSLocalizedString(@"Delete All", @"");
        else
            NSString *titleFormatString =
            NSLocalizedString(@"Delete (%d)", @"Title for delete button with placeholder for number");
            self.deleteButton.title = [NSString stringWithFormat:titleFormatString, selectedRows.count];
    @end

    Make sure that you do not run Firefox in full screen mode (press F11 or Fn + F11 to toggle; Mac: Command+Shift+F).
    *https://support.mozilla.org/kb/how-to-use-full-screen
    Make sure that toolbars like the "Navigation Toolbar" and the "Bookmarks Toolbar" are visible.
    *Firefox menu button > Options
    *View > Toolbars (press F10 to display the menu bar)
    *Right-click empty toolbar area
    Use Toolbar Layout (Customize) to open the Customize window and set which toolbar items to display.
    *check that "Bookmarks Toolbar items" is on the Bookmarks Toolbar
    *if "Bookmarks Toolbar items" is not on the Bookmarks Toolbar then drag it back from the toolbar palette into the Customize window to the Bookmarks Toolbar
    *if missing items are in the toolbar palette then drag them back from the Customize window on the toolbar
    *if you do not see an item on a toolbar and in the toolbar palette then click the "Restore Default Set" button to restore the default toolbar setup
    *https://support.mozilla.org/kb/How+to+customize+the+toolbar
    *https://support.mozilla.org/kb/Back+and+forward+or+other+toolbar+items+are+missing

  • Question regarding ScrollView and pageControl with multiple XIBs

    Hi,
    I am very new to iPhone programmming and OO type programming in general so please forgive me for my basic questions.
    I am trying to set a paging scrollview up with each page being loaded from a different XIB and put into a view controller. This viewcontroller is attached to a scrollview that's put on a "Detail" view. I have this working OK with blank XIB pages.
    My question is, when I start adding fields/buttons to the different XIBs how should I then process the actions etc. Do I create a seperate .h and .m file for each XIB and add the individual screen processing into the individual classes or do I use a single class (the "Detail" screen) and do all the processing in that class?, is that even possible?
    I do hope that this makes sense. I'm still going through the basic learning books and I'm maybe trying to run before I can walk.
    Any help is most appreciated.
    Thanks

    Hi Ziximo, and welcome to the Dev Forums!
    Ziximo wrote:
    I am very new to iPhone programmming and OO type programming in general so please forgive me for my basic questions.
    No forgiveness is necessary. You came to the right place.
    I am trying to set a paging scrollview up with each page being loaded from a different XIB and put into a view controller. This viewcontroller is attached to a scrollview that's put on a "Detail" view. I have this working OK with blank XIB pages.
    In case it's useful to you, here's a thread which shows how to use the PageControl sample app as the template for what you're doing: [Re: Flipping through views help|http://discussions.apple.com/thread.jspa?messageID=10417960&#10417960].
    My question is, when I start adding fields/buttons to the different XIBs how should I then process the actions etc.
    The advice you have from thomas-r is right on target, so I'll just try to add to that. Firstly, I think you may be making a diligent attempt at "top-down" design, which is commendable. However there's a dirty little secret that working programmers don't share with managers: Quite often we don't produce the functional specification until we get the code working.
    In other words, thomas-r's reference to Murphy isn't an insult. That's just how software gets designed.
    In general, the decision to make a new class should be based on encapsulation and re-usability. For example when you get a memory warning, you might want to release all of the resources required for a screen that isn't currently visible. If that screen and its controller can be fully regenerated from one nib, this can be an easy task.
    As another example, say the top-level controller is an instance of your ScrollViewController class. If you limit that controller to managing the scroll view and page control, you'll probably have a class you can reuse the next time you need a paging scroll view. But if you pack the functionality for multiple content views into that same controller, the class will only be useful for an identical app.
    .. or do I use a single class (the "Detail" screen) and do all the processing in that class?, is that even possible?
    So, no, I would definitely not attempt to put all the control in one class. Yes, it's possible, but besides being bad practice, it's awkward to implement. For example, when you make a nib which is owned by a view controller, it's easy to connect that controller's outlets and action methods to controls which are defined in that nib. There are ways to connect controls to an object defined in another nib, but it's much more difficult. It's not a "natural" configuration, and that by itself should give us second thoughts about our design. On the other hand, if we make one giant nib which is owned by the top-level controller, memory management goes out the window. We would need to unload everything in that nib to gracefully handle a memory warning.
    Do I create a seperate .h and .m file for each XIB and add the individual screen processing into the individual classes ...
    Yes. This gives us the reusability and encapsulation we want. The only remaining question is: "Do I need a separate controller class with it's own custom xib for each screen?". Well you may not. There could be two or more screens that are so similar (e.g. the same layout and functionality but with a different image) they can each use an instance of the same controller class and share the same xib.
    I usually start with a different controller class and a different xib for each screen. Then, near the end of the project, I'll look at all those controllers and see if two or more are nearly identical. If so, I might get rid of one or more classes, and possibly one or more xibs as well. But I'd almost never assume I can merge two controller classes at the outset. If I did that, I might start adding kludges to the merged class as I found differences between the screens I hadn't seen earlier. When the merged class finally got too complex for anyone to maintain, the job of splitting it up might be nasty.
    I do hope that this makes sense.
    I think that's my line.
    I'm still going through the basic learning books and I'm maybe trying to run before I can walk.
    If you've suceeded in getting the skeleton working--i.e. you're paging through blank screens, each with it's own vanilla controller/xib, without any bugs, I'd say you're more than ready for the question you're asking here. And it's a very good question.
    \- Ray

Maybe you are looking for

  • Printing problem with .pdf

    27" iMac (2012), OS X 10.9.1, Canon MF4770n laser connected by ethernet cable through AirPort Extreme, HP C4200 connected directly via USB The Problem:  I received a .pdf file via e-mail and downloaded it.  It consisted of a series of forms in unknow

  • Itunes error during install service apple mobile device failed to start.. help

    I had to install Chrome browser in order to use my gmail account.  Now I cannot open itunes on my Window Vista computer, get a Microsoft Visual C++ Runtime Library. R6034. I uninstall itunes and reinstall itunes 64-bit itunes installer.  During insta

  • TS3423 How do I apply firmware update 1.9 on 10.6.8?

    Hi, I'm trying to update the firmware on my MBP 15" (MacBookPro6,2) but I'm having trouble. I want to update to 1.9 (yes there is  an update to 2.3 or something but this requires lion which I have no intention to upgrade too), this says it requires 1

  • Doesn't send me an e-mail to reset my password

    I had made an Apple ID for my iPad, but when I tried to log into my Apple ID account in settings under iTunes&App Stores, it said that "Your Apple ID or password is incorrect". I repeatedly tried to log in, but it continued to inform me that it was i

  • Why is iTunes Australia so far behind?

    iTunes Australia is so far behind America. It's rubbish. I know why people illegally download now.