IPhone SDK: How to access navigationController in appDelegate?

Hi,
This is probably a noob question, but I'v spent all day on this and cant figure it out.
After creating a project using the Navigation-Based Application template the folllowing code was automatically created:
@interface NavigationAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
UINavigationController *navigationController;
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;
@end
I am writing code for a viewContoller and would like to push another viewController onto the stack of this navigationController but don't know how to access it. So far I have written the following:
[??????.navigationController
pushViewController:scr1ViewController animated:YES];
What do I put in place of ?????? Everything I try returns an error.
Thanks in advance.

Its ok, Iv just figured it out. Been staring at it for seven hours with no luck. As soon as Iv posted the question I decided to try 'self' it worked.

Similar Messages

  • IPhone SDK - How to add application files and folders to Xcode?

    I want to package a folder with data specific to my app. The data is just a bunch of binary files in proprietary format.
    These files should be installed under /Documents folder of the application. The files themselves will be in a folder called say Data. So when i run the app from Xcode i want it to copy the files to
    /Documents/Data folder under the bundlePath.
    There could be a file called data.dat under the Data folder.
    So in my application i want to be able to use the NSFileHandle interface or the standard C fopen() function to access the file /Documents/Data/data.dat .
    How can i do this using Xcode? Is there a tool one needs to use to create an install package?
    Any help would be greatly appreciated.
    -TRS

    If you look at the SQLiteBooks example, it shows and example of installing some extra data (books.sql) into the documents folder. Look at the function createEditableCopyOfDatabaseIfNeeded in AppDelegate.m
    You should also add in the starting/static data files in the build process in XCode - you can probably add to, or create another build step that will copy the files from your host machine into the app bundle.

  • [IPhone SDK] How to create dylib on iPhone

    Hi all,
    I am developing an iPhone application. I need to put some of the code in a dylib and link it to my application project.
    How do I create dylib using xcode and how do I link it to my application?
    Thanks for ur help in advance.

    I don't believe you can, at this time, use your own dylibs or frameworks. You'll need to use static libraries instead.
    rob.

  • IPhone SDK: How to have application files not be backed up by iTunes?

    We are writing a set of files to the tmp directory on the device, with the expectation that iTunes will not back it up. However, we are seeing that those files are backed up on the host computer.
    The following documentation:
    http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhone OSProgrammingGuide/ApplicationEnvironment/chapter6_section3.html
    says:
    "tmp/ — The application writes any other temporary files here. The application is responsible for cleaning up all files created in this directory; there is no automatic cleanup mechanism. Backup operations ignore the contents of this directory."
    A sample value returned by NSTemporaryDirectory() is:
    /private/var/mobile/Applications/65BED698-7789-41A0-A9BC-06BBDC5EB654/tmp
    For which we are saving our files in:
    /private/var/mobile/Applications/65BED698-7789-41A0-A9BC-06BBDC5EB654/tmp/NSData /080702c
    However, when the device is disconnected and reconnected to the computer, and iTunes does a backup, we can see the files from tmp being transferred to a backup directory, eg.:
    ~/Library/Application Support/MobileSync/Backup/fb0a4b743a3c826d3146e0e34a9aa16e3c11eb0c
    Our questions are:
    1. Is the documentation correct about tmp not being backed up?
    2. Are we getting the path to tmp correctly?
    3. Is there something we can do or set to get tmp to not be backed up?
    4. Is there another directory we should be using for data files which need to persist between application launches but not be backed up?
    5. We have noticed that the path returned by NSTemporaryDirectory() is not the same as that formed by adding "tmp" to the path returned by NSHomeDirectory(); the former is /private/var/mobile/Applications/.../tmp while the latter is /var/mobile/Applications/.../tmp. Yet writing files to either seems to put them in the same place - are symbolic or other links being used to make these paths refer to the same directory? Which one should developers use?
    Thanks in advance for any suggestions and help.

    Partly to bump this but also to restate the question in less detail we a) want to save a number of text files for our app to use as a cache when it's relaunched, and b) don't want those files to be backed up by itunes when the iphone/touch is synced with the computer. How to do that?
    We thought the "tmp" directory within our application's sandbox would be the place for that, however, itunes is backing up the files we put there.
    Any ideas or suggestions much appreciated.
    Thanks.

  • IPhone SDK: How to create an image from raw data

    Creating a UIImage from some form of bitmap file format is easy, whether you let UIImage load the file itself or create it with an NSData. But what if you have raw bitmap data in memory and you want to create an image?
    In Cocoa NSBitmapImageRep can be created by passing it a pointer to a block of memory and the relevant heigh, width, bit depth etc. information. From that you can easily create an NSImage. There doesn't seem to be anything equivalent on the iPhone. CGImage can be created but it looks like you have to write a CGImageProvider. CGBitmapContextCreate takes a void * to a block of memory. Does it clear that block?
    Is there a good way to do this?

    ElNono wrote:
    You can't do RGB565 on a CGImageRef/CGContextRef. The only 5bpp modes supported are 1555 ARGB or 5551 RGBA. If you just need to display the image, use OpenGL. One of the supported texture formats is RGB565. If you need to save the image then you're going to have to pre-convert it to RGB888.
    hi ElNono , i have test the RGB888 data now , the image can show , but another problem is the image just like serveral picture over lap together , also is blurred , my code is here:
    const size_t width = 1024;
    const size_t height = 768;
    const size_t bitsPerComponent = 8;
    const size_t bitsPerPixel = 32;
    const size_t bytesPerRow = (bitsPerPixel * width)/8;
    CGBitmapInfo bitmapInfo = kCGImageAlphaPremultipliedLast;
    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
    NSString *imagePath = [[NSBundle mainBundle] pathForResource: @"Test" ofType: @"rgb"];
    NSFileHandle* file = [NSFileHandle fileHandleForReadingAtPath:imagePath];
    NSData* imageData = [file readDataToEndOfFile];
    CGContextRef context = CGBitmapContextCreate((void*)[imageData bytes], width, height, bitsPerComponent, bytesPerRow, colorSpace, bitmapInfo);
    CGImageRef imageRef = CGBitmapContextCreateImage (context);
    UIImage*rawImage = [UIImage imageWithCGImage:imageRef];
    CGColorSpaceRelease(colorSpace);
    CGContextRelease(context);
    CGImageRelease(imageRef);

  • [IPhone SDK] How to close all pages after safari exit

    Apps close when you hit the home screen, however i find that Safari seems to keep multiple pages open even you close it , which no doubt uses memory. so does anyone know how to close these pages after safari exit ? Thanks very much.

    Does anyone know it , please give me some advises , thanks very much.

  • IPhone SDK: How to convert Pixel values into Point values

    UIScrollView has a property called contentSize. This takes values in points. How do i convert Pixel values into Point Vales?
    -TRS

    As far as I can tell, they're the same - I know they are in Photoshop at least. My 57x57 point Tab Bar icon is also 57x57 pixels.
    Hope that helps

  • IPhone SDK - How to rotate the Aspen Simulator

    I have the Beta 3 installed. The Aspen Simulator menu has a menu item called Hardware which has *Rotate Left* and *Rotate Right*. When i try rotate it does not do anything.
    Have others experienced an issue with this? From some post it seems like this works for them. So i would like to know what i am doing wrong.
    Thanks in advance.
    -TRS

    In Beta4, the Simulator now rotates irrespective of whether the application handles rotation or not. That is one difference from earlier.
    Secondly i registered for UIDevice UIDeviceOrientationDidChangeNotification and now i do get notified when the orientation changed.
    Of course the view itself is not rotated automatically. Seems like the UIViewController has code to rotate the views. In other handheld devices for e.g on Palm and Windows Mobile when the device changes orientation the application views are automatically rotated. You do have to handle the changes to the new screen size and adjust your views. I had expected something similar on the iPhone and am a bit surprised at this behavior.
    I don't have anything against View controllers. I guess it is just that i don't understand them that well. I don't want to use the Navigation bar or the Tab bars. I want my views to have a custom header view and a custom footer view. And i plan to load the new content view on the current parent view and handle the Back stack myself. So the header and footer view remain fixed and the only thing that slides in and out is the content view. From the documentation and the WhichWayIsUp sample it is clear that i can use a view controller for the main view and not use the navigation bars or tab bars. I guess i just need to try a few things out to see what will work for me.
    Thanks once again for your feedback.
    -TRS

  • IPhone SDK: How to use a specific UIFont with UIWebView

    Is there a way to doing that?
    I do not want to use the default system font but a custom font that will be inlcuded in my application.
    Thanks,
    DUY

    CrossOver is a program that lets you run some Windows software withhout installing Windows. The emphasis is on some. At their website Crossover rates the supported software on a scale from Bronze to Gold - if the program you need to run is supported at the Gold standard you will probably be okay. Silver and Bronze ratings means the rated Windows software will run but with glitches or even missing functionality. (Silver being better support than Bronze, obviously.)
    Virtualization solutions such as VirtualBox (or the more capable and feature laden Parallels Desktop and VMWare Fusion) let you install another operating system (and software) to use at the same time as you use your Mac software. It is a nifty solution and while virtualization isn't quite as fast as running an OS totally native (BootCamp) the speed hit isn't all that significant and affects graphics rendering more than anything else.
    I'm an IT instructor and software trainer and about 80% of this work involves Windows software. I do it using a Mac computer running Windows in Parallels Desktop. If it weren't for the Apple logo on my notebook no one would know I'm using a Mac - and the notebook in virtualization feels faster than the cheap Dell computers we use.

  • IPhone SDK: How can I disable the keyboard on a UITextField

    I would like to disable to keyboard for a UITextField. When someone touches the textfield, I would like them to be able to manipulate the cursor inside the field but I do not want a keyboard to appear.
    In other words, simply unchecking the enable option in IB is not going to work. The field needs to be enabled but I would like the keyboard to stay hidden.
    Any ideas?

    Check UITextFieldDelegate textFieldShouldBeginEditing. Return NO and see what happens. I'm not sure if that will fix it though.

  • IPhone SDK - how to dim screen?

    Is it possible to dim the screen to save battery life? Our app uses UIApplication's idleTimerDisabled so we continue to receive input from sensors but at some moments the user interaction is not required so we'd like to dim the screen when this happens.
    Thanks!

    I would like to do this as well, has anyone found a way to accomplish this?

  • Which Macs will run the IPhone SDK

    I Got spooked.
    'Turns out my PowerPC processor won't allow the IPhone SDK to install even though it doesn't give me any message indicating so.
    So I have to buy another machine and want to make sure it will run the IPhone SDK
    How about Intel Atom Processor N270 1.6GHz single core?
    Thank you so much. Answers to other questions have been very helpful.
    Jerry

    Sorry Orange,
    You answered about the duel core. I am now asking about a different machine. I am hoping to get answers about several so that it can also be helpful to others.
    Thanks tod,
    That's helpful. Since I am running 10.5.5 on a real Mac and it won't take IPhone SDK now I am wondering just what will take it.
    So now I know the Intel® Atom Processor® N270 in the Dell Inspirion minis won't.
    Will the IPhone SDK only run in a machine built by Apple and after they started to use Intel?
    Jerry

  • How to switch between views in iPhone SDK

    I have been tasked to learn the iPhone SDK. I know Actionscript, Javascript and some Java, but I cannot understand the iPhone SDK at all. I cannot understand the syntax or how the multitude of files work together. Also, there are no tutorials for complete beginners that show step-by-step what to do and why.
    All I am trying to make is an application with a couple of views that change when the user touches a button. What is the easiest way to switch from one view to another?
    Also, what is an AppDelegate? What is "synthesize"? What is "nonatomic,retain"? Why can't I write code like this... theButton.onClick=loadView("NewView");

    Ok, you really need to read up some on how Objective-C and Cocoa work.
    That said, If you make a new project in XCode using the "Utility" template, you can immediately run it and see a view transition (flip).
    Ultimately, however, what you're looking to do is way beyond what you should be expecting to be to be able to do at this point. Programming a scripting language (Javascript, ActionScript) is much different than programming in C/C+/Objective-C/Objective-C+. While not directly applicable to the iPhone, you'll probably want to buy and read Aaron Hillegass' book "Cocoa Programming for Mac OX X 3rd Edition".
    There is a tutorial on the iPhone Dev Center (log in, main page, bottom right, under "resource types", click "Guides", and look for "iPhone Application Tutorial" on the next page) that is worth reading.
    rob.

  • IPhone SDK: access outside the sandbox?

    In reading the docs for the iPhone SDK the sandbox aspect makes it sound like it will be impossible to create utilities that manipulate the system, other apps files, etc. Has anyone gotten a better read on this?
    For example if you wanted to build something that would crawl the filesystem (e.g. a backup tool), how would you do it?

    I don't know about the file system... but you can access pictures from the photos and addresses from the address book (music?) so some sort of rudimentary backup could happen... but then, if you can only backup to the same hard drive you are using it's not much use.

  • HT4352 How can I get Home Sharing turned on my Apple TV if I have lost my remote control and my remote apps on my ipad and iphone can not get access to my apple tv, only my itunes.

    How can I get Home Sharing turned on my Apple TV if I have lost my remote control and my remote apps on my ipad and iphone can not get access to my apple tv, only my itunes.

    You can't, you will need to get a new remote.

Maybe you are looking for