Simple nib file question

I believe that all the examples I've seen of nib/xib files have been connections to the corresponding controller or view files, or to the app delegate and the main window,
Please correct me if I'm wrong, I might just be tired and missing an important clue
I'm using a Utility Application template, and have most of my work done using the MainView and MainViewController. I'd like to now work on the FlipsideView and FlipsideViewController to display and/or manipulate status and options, which is already in instances/classes in the MainView and MainViewController type.
How do I access data in the other View, ViewController, or app delegate by connecting buttons and fields from my FlipsideView?
This may be a "duh! Oh Yeah" question/answer, as in just examine how the FlipsideView is connected to the MainViewController. However, I could use a little leading and pointing here.
In my test app, I've already created a number of labels for static info, or to hold the value of a field in the other class instances. I'm just trying to figure out how to make the connections. I do have a few of the data elements setup with IBOutlets already.

When the controllers of separate nibs need to communicate with each other, the best solution depends on the structure of the program and how many controllers are involved. Luckily the discussion gets much easier if we restrict it to the nibs in the Utility template. However, the Utility template that came with SDK 3.0 is quite different from the 2.x version. I'll start with 3.0.
With the 3.0 Utility template you have a built in communication channel because the flipside view controller is the modal child of the main view controller. That means flipsideViewController.parentController points to mainViewController. And mainViewController.modalViewController points to flipsideViewController.
So for example, if textField1 is in the main view, and label1 is in the flipside view:
// in FlipsideViewController.m
self.label1.text = parentViewController.textField1.text;
Note however that communication in the other direction is limited to the time the flipside view is active. While mainViewController will always exist when the flipside view covers it, the flipsideViewController is released when its view is dismissed. So in order to export info from flipside to main, you might have the flipside controller save the data ahead of time. For example if the mainViewController needs the text from label2 which is on the flipside:
// in FlipSideController.m
parentViewController.copyOfLabel2 = self.label2.text;
You also mentioned getting data from the app delegate. The app delegate is accessible from any object in the program precisely because it's "the shared application object's delegate". So for example, if mainViewController is an instance variable (with a matching property) of the app delegate, a method of any object in the program could obtain a pointer to the mainViewController, and thus any objects in its view:
// in AnyClass.m
#include "MyAppDelegate.h"
#include "MainViewController.h"
- (NSString*)getTextField1 {
myAppDelegate *delegate = [UIApplication sharedApplication].delegate;
MainViewController *mainViewController = delegate.mainViewController;
return mainViewController.textField1.text;
The solution for the 2.x version of the Utility template is based on the fact that both the main and flipside controllers are children of a root view controller. I'll wait to find out which version you have before dealing with the 2.x template.
Hope that helps!
- Ray

Similar Messages

  • Nib file question

    @implementation HelloView
    - (id)initWithFrame:(NSRect)frame
        self = [super initWithFrame:frame];
        if (self) {
            // Initialization code here.
        return self;
    What does this code initialize? I thought it called an object in the foundation code, but apparently it's an object that has been placed in a nib file?

    Okay, so NSWindow is actually not an NSViewClass object?
    I could instantiate a window with NSWindow code, or else use NSView in conjunction with the nib file which will instantiate the NSWindow object into an NSView object, which can then be subclassed into the application. Is that right?

  • Switch between Nib files

    Hi everybody,
    I am struggling with a functionality which I thought of as "simple" at first. A little background:
    1. I have two digital cameras and two nib files containing the GUIs for either camera.
    The GUIs are controlled by two NSWindowController objects (Camera1Controller and
    Camera2Controller).
    2. If no camera is connected show an openning screen GUI (MainAppGUI.xib).
    3. Target behaviour: plug in either camera -> show the right GUI.
    4. The target behaviour may be repeated as often as the user wants.
    What I did? Created a class MainAppDelegate of type NSObject<NSApplicationDelegate>.
    This class is the owner of the MainAppGUI.xib and is the "Main nib file". It receives
    the notifications from either camera when they are connected and tries to load one
    of the Camera1.xib or Camera2.xib. I use the NSBundle loadNibNamed:owner: method.
    Here comes my first question, how can I set the owner of the files? What are the right bindings
    to File's Owner in the interface builder of the Camera1.xib, Camera2,xib and MainAppGUI.xib.
    Do I have to use a document based application? I know that those questions seem like I have
    to read more but I really did and seem to grow just all the more confused not smarter.
    So please any pointers or help will be highly appreciated.
    Best Regards
    artOf...

    Ok

  • Can i create a home window without using a NIB file

    I hate interface builder, it is a really counter-intuitive piece of junk. Please don't try to convince me otherwise I prefer to do it all in code. Right now i have my whole product running dynamically, creating all the interface objects programmatically as my positioning is all calculated on the fly.
    However I still have one NIB file (MainWindow.NIB) that creates the home window and somehow links to my AppDelegate class, which is the startup class for my app. I see that my main.c routine calls UIApplicationMain() which somehow loads the main nib (hidden magic here), and then eventually my AppDelegate() method which is of calss UIWindow() gets called with an initialize() call followed by applicationDidFinishLaunching() call and off we go.
    Can I create the window dynamically by not using NIBs? Now that we have ipad and iphone to contend with, I would want to create a window that is either 320 x 480 or 768 x 1024 depending on what machine I am on. I would like to get rid of the NIB because I don't understand the wiring stuff and I tried to make a NIB myself but now get a cryptic error message, and anyway the NIB has a fixed size and my app wants to be dynamic now that we have two screen sizes.
    The second part of the question is how do you know what kind of machine you are on? I don't see a Gestalt() routine like in the old mac days so you can tell what machine it is.

    There are always less-informed people who think that a STATIC development tool is somehow more powerful than a flexible dynamic interface computed as one goes. The idea of a static screen form that you control dates back the 80's; modern interfaces are DYNAMIC and interface builder cannot construct those; sure it can perhaps help you lay out things, but if the user turns on certain features then new controls are visible. We have built products with over 500 controls in them and as only perhaps 25 are needed at any one time the software rearranges the screen in the most optimal form at all times. The more advanced the product the more one chafes at a static design tool.

  • CGI map file questions, help !!!

    I am trying to use the CGI map file to open web reports. I got two questions at this time.
    1. How to refresh the report to reflect resent edits ? I used the CGI map to open a report. Later, I made some edits to the report and opened it again. However, the browser showed the report before the edit. I had to save the report to different file name and edited the key in the map file to show the edited report. This should not be the right way.
    2. How to open a report on a separated screen which is on top of the original one ?
    Any suggestions? Thanks!
    null

    Hi Kate.
    As far as a find and replace tool is concerned, most of us
    here prefer using some tool such as FAR or BkReplacem as they offer
    more features to help in this kind of scenario. The simple answer
    is however that these tools, as indeed does the inbuilt tool, bases
    it's search on the HTML. Therefore if there are specific instances
    of HTML strings you will have to analyse carefully them before you
    replace anything. It sounds like you are already some down down
    this line. Take a backup of your project and test out your theory.
    As far as your map file question is concerned, you can safely
    reimport your map file PROVIDED that no changes have been made to
    the mapids in the meantime. Personally I wouldn't do this unless
    you are 100% sure of this. If it is a case of having 100s of topics
    that are not mapped and never have been but could be, I'd just
    create a new map file and map away.

  • Drag and drop simple ".mov" files, into 2 dif. browsers, no longer working

    -
    Did something, that caused my main drag and drop, of simple ".mov" files, into 2 different browsers - "Safari", Version 3.0.4, and "Camino", Version 1.6.8, .. to stop working.
    To be clear, this is regarding, just some simply ".mov" files which I have generated. (Individual hourly, weather images - like; in sequence. Generated, in / with, QuickTime - itself.)
    At this point, where dropped from a folder, into "Camino", .. it routes these back to my main desktop. - (Before the problem, .. played them, in browser.)
    "Safari", only brings up the folder that the main file is in — within a separate folder window.
    (As with "Camino", played these in browser, previously.)
    (Have gone into "preferences", either browser, .. and can't figure things from there.)
    Problem occurred follow two different downloads / installations
    "DjVu Browser Plug-in"
    http://www.caminova.net/en/downloads/download.aspx?id=1
    and, ..
    "Flash Player" (.. for Mac OS 10.4 - 10.5)
    http://get.adobe.com/flashplayer/otherversions/
    Have tried, either "uninstalling", .. or "trashing" these.
    (Uninstalled, "Flash Played" - with specific "Uninstalled" app.. / "Trashed" "DjVu Browser Plug-in".)
    Any help, certainly appreciated.
    Rm(richard583a)

    -
    It, .. or they, don't within either browser that I have installed - and am using, ..
    .. they had previously, ... don't know what I did exactly to caused this circumstance.
    .. is my question. (.. if not fully clear.)
    Just looking to try to find out what I can do, either whether to "back-off" from what I've done - more recently, regarding the two different downloads that I've pointed to above, .. apparently - only, having, superseded a more simply configuration .. previously working.
    This, or either, adjust the settings - broader / somewhere (more generally) - otherwise, .. in order to have these files, play, .. in browser.
    Rm(richard583)

  • Main window ptr. from separate NIB file

    Hi All,
    This sounds like the simple kind of job a programmer would do everyday, but I haven't been able to figure it out yet.
    My NSObject app has the usual main window and MainMenu.nib file, and my user-defaults are kept in an NSWindowController subclass complete with its own separate Preferences.nib file. It does the job but I'd prefer to attach the prefs window to the main window as a sheet rather than present it as a separate pane.
    Assuming this is possible, I'd at least need a pointer to the main window to start with. How can I get the main window's pointer from within this separate nib file, please?
    Thanks in advance
    Ernie

    Thanks guys. I've figured this out now!
    Ernie

  • System wide failure to load .nib files

    Hi everyone,
    I've recently stumbled across a problem. Several of OS X bundled applications are no longer functioning due to uncaught exceptions in the application.
    1) Mail.app throws an exception and terminates when trying to open an e-mail message:
    *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[NSViewController loadView] could not load the "MessageView" nib.'
    2) Stickies.app (Sticky notes) generates a log record (seen in the console app) when attempting to show a sticky note:
    From the console log:
    -[NSWindowController loadWindow]: failed to load window nib file 'StickiesDocument'.
    But the application is not getting terminated.
    3) Preview.app has stopped working, but is not generating any log records or uncaught exceptions.
    4) Terminal.app generates a log record when attempting to open a terminal window at startup:
    From the console log:
    -[TTWindowController loadWindow]: failed to load window nib file '(null)'.
    There might be other apps that could possibly have the same issue
    Having provided the background of the issue my question therefore is: What might be possible solutions to this? (Except reinstalling OS X which is the last (and only) option on my list)
    Thanks in advance!
    With regards,
    Valentine

    Unfortunately, there is no where to download Apple's applications without reinstalling.
    Do a backup. Boot to the Recovery Volume (command - R on a restart or hold down the option key during a restart and select Recovery Volume). Run Disk Utility Verify/Repair and Repair Permissions. Then reinstall the OS.
    OS X Recovery
    OS X Recovery (2)

  • Why can't I find the "MainMenu.nib" file on my Macbook air?

    I'm trying to remove private browsing from my computer and I need to find the "MainMenu.nib" file... when I go to that directory it isn't there.
    Help please.

    Can someone please help me with my question?
    I'm trying to remove private browsing from my computer and I need to find the "MainMenu.nib" file... when I go to that directory it isn't there.
    I'm running Yosemite.

  • Problems loading nib files after class is split into a static library.

    I've recently split a project so that the common re-usable controls are in their own class library. My original application project now references these using a cross project reference.
    However, since I have split the projects up, my original project crashes when it loads main.xib because it cannot find one of the custom classes which is defined in the library project.
    When I first split up the projects, I noticed that there were problems with the nib files not being able to find the IB outlets of the custom classes, but I managed to get around these by going importing the relevant library class files manually (File > Read Class Files…).
    I have made sure that all of the nib files compile without warning, so as far as I can tell, Interface Builder is able to read the necessary class headers, but when I try to run the app, it crashes saying that there is an unknown class in the Interface Builder file and that the class is not coding compliant.
    Are there any steps I've missed or advice on how to troubleshoot this?

    I did a bit of digging. The reason why this wasn't working is because the class in question was referenced by the nib files, but not in code. Therefore, while the code compiled and there were no warnings with the nib files, the linker was not linking the classes because no code used them directly.
    This can be fixed by going to the Project Settings, and on the Build tab, underneath the Linking heading, adding -ObjC to the Other Linker Flags section.

  • Invalid Binary: "Missing .Nib File" ?

    Dear Adobe Community,
    I have a big problem... When finally I've uploaded the Binary file of my App to iTunnes Conect, I've received several emails like this from Apple after several attempts:
    "We have discovered one or more issues with your recent delivery for "Name of the App". To process your delivery, the following issues must be corrected:
    The binary being analyzed must be an executable: /tmp/mz_4718812371818442247dir/nameoftheapp.zip/viewer.app/viewer
    Missing Nib File - The referenced nib file 'MainWindow.nib' was not found in the application bundle.
    Once these issues have been corrected, go to the Version Details page and click "Ready to Upload Binary." Continue through the submission process until the app status is "Waiting for Upload." You can then deliver the corrected binary."
    I'm going crazy with this. It is the first time that something similar is happening to me, please, someone have the solution for this problem?
    Really appreciate your help and any suggestion from Abode team!
    Best,
    E.

    Just to echo this - we have the same problem. We are going to try renaming the file and resubmitting but the concern must be problems further down the line.
    I am concerned about the process of unzipping and rezipping the file as there may be issues with encryption?
    In addition there are a number of other *~ipad.nib files included in the app build which we have not renamed - however it seems logical that they may also be affected.
    Grateful as the other posters have commented for an update on this issue as soon as you have it.
    Thanks
    UPDATE 12.20pm BST
    We unpacked the file, renamed the file in question, rezipped and sent it off again. This time no error email yet from Apple, and status has changed to Waiting For Review. Seems a bit too easy though....! Hard to believe we won't get another error back in due course, but I guess you never know.
    Message was edited by: tortoise816 to update our situation.

  • AppleScript Studio - Huge .nib file?

    I'm creating my first AppleScript Studio application, and I've noticed that one of the nib files used in the project has grown to a huge size (20MB)... and I'm wondering why, and whether this is normal?
    (One other has grown to ~5MB, the other three are small ~50kB - around what I'd expect.)
    I do have two buttons that show icons - but the files are small ~100kB each... not enough to explain 20MB worth of nib. (Besides, I thought that the icon files are stored separately - they are copied to the resources folder by XCode.)
    It's not a huge concern at the moment, because everything works, and 20MB is not huge... I'm just concerned that such a simple App has an interface file that's 20MB (the entire app builds to 27.2MB, with 26.2MB of nibs... surely that's not normal?
    Any ideas?
    EDIT: Sorry, I should have mentioned that I'm using IB v 3.0 (629) on Leopard 10.5.2.
    Message was edited by: OSXAlex

    Michael,
    I guess you should be able to do this using a shell script and "curl" - the one problem with curl is that it won't honor your system's proxy settings...
    Andreas

  • How can I switch to a different Nib file with a button

    Hi there Im working on a Xcode application for IOS and I must admit im kinda new to Objective C. This specific application requires me to switch between different nib files. I am having quite a difficult time trying to figure this out on my own so some help would be appreciated. I have got the button linked with an
    - (IBAction) but i can't quite get the coding to get the buttton to open the next application or nib file.
    Thanks ~Cal~

    What i want is that it opens an application menu with several buttons, and then you press one and it opens a new window full of buttons
    and i want it to be a mac osx app:)

  • What's wrong with this simple java file

    I am learning java input methods. When I tried to compile the below simple java file, there were two errors.
    import java.io.*;
    public class MainClass {
       public static void main(String[] args)  {
        Console console = System.console();
        String user = console.readLine("user: ");
        System.out.println(user);
    }The compiler errors:
    h:\java\MainClass.java:5: cannot resolve symbol
    symbol : class Console
    location: class MainClass
    Console console = System.console();
    ^
    h:\java\MainClass.java:5: cannot resolve symbol
    symbol : method console ()
    location: class java.lang.System
    Console console = System.console();
    ^
    2 errors
    Could anyone take a look and shed some lights on this?

    I have changed to "import java.io.Console;" but this below errors:
    h:\java\MainClass.java:1: cannot resolve symbol
    symbol : class Console
    location: package io
    import java.io.Console;
    ^
    h:\java\MainClass.java:5: cannot resolve symbol
    symbol : class Console
    location: class MainClass
    Console console = System.console();
    ^
    h:\java\MainClass.java:5: cannot resolve symbol
    symbol : method console ()
    location: class java.lang.System
    Console console = System.console();
    ^
    3 errors
    -----------

  • Java.lang.SecurityException using a simple jar file

    I created my small application using JDev 11.
    Running from JDev it works well.
    I created a simple jar file including all my classes and all libraries I used.
    Whe I try to run that jar file I get :
    java.lang.SecurityException: no manifiest section for signature file entry javax/mail/internet/AsciiOutputStream.classI didn't find any solution.
    I worked hardly with JDev 10g but I never had such problem.
    Tks
    Tullio
    Edited by: tullio0106 on Nov 25, 2008 2:22 PM

    I simply created a project containing some classes whish use java mail.
    Then I modified the project creating, in the deployment wizard, a "Dependency Analysis" filegroup adding all my classes as well as libraries.
    I uncheck the "Include Manifest" chek otherwise I would run into different problems (well documented in the forum).
    The jar file is created but when I run the application I get the Security error.
    If I remove java mail libraries (activation and java mail)from the list of used libraries and I add it to classpath it works fine.
    I suspect the problem could be in Manifes merging.
    Tks
    Tullio

Maybe you are looking for

  • Idoc Msg Type COND_A in MM condition transfer

    Hi, Idoc message type COND_A is used to transfer condition records from one client to another using ALE.We can use t-code MEK3 to transfer PB00 condition type . Can anyone tell me which t-code is used to transfer condition types other than PB00 like

  • NI-PCI 8431/2 buffering

    OK, I have a 8431/2 that needs to receive data(each message is 5 bytes) coming in at 19200 with 2 IDLE characters between each message. No term chars, no breaks. I also need to process each message real time. What is a good labivew design approach he

  • Best-selling ColdFusion Author Ben Forta Keynotes at AFPS 2010

    Ben Forta is Adobe Inc.'s Director of Platform Evangelism and has over two decades of experience in the computer industry in product development, support, training, and marketing. He is the author of the best-selling ColdFusion Web Application Constr

  • How to get a Skype credit refund: my Mac is no lon...

    Skype normally does not give refunds unless credit was purchased in the last 15 days. However, I can no longer use Skype credit because of Skype policy: Skype will not allow my Mac to connect, it has disabled by version of Skype. I cannot upgrade (in

  • I have dropped my phone and broke the screen

    hello guys i have dropped my iphone 4 and shattered the screen, do you know the best place to get it repaired and how much will it cost me i live south of the river (perth) the phones only a few months old aswell