UIImagePicker on a navigation controller

hello i have a navigation controller which has 3 view controllers. the second one has 3 images and three buttons each of them goes to third view controller which has an image viewer i want the user depending the button pressed to show the appropriate image on the third view controller using the image picker. The photos are placed in an array with photos.

Hi ZaaBI -
ZaaBI_AlonSo wrote:
i want the user depending the button pressed to show the appropriate image on the third view controller using the image picker.
If I understand correctly, you want to set the picker source to a custom set of images based on the selection in your second view controller. UIImagePickerController doesn't support this requirement. The picker will only present images from a system source such as the user's photo album or camera roll.
This SO thread includes links to both the Three20 framework and JPImagePickerController, either of which might solve your problem: [Is there a way to use the UIImagePickerController with your own images?|http://stackoverflow.com/questions/2180214/is-there-a-way-to-use-the-ui imagepickercontroller-with-your-own-images].
\- Ray

Similar Messages

  • Multi layer table view/navigation controller hierarchy best practice

    Hi,
    I am new to iPad/iPhone development and wondering what the best practice for multiple layers of table views is? I understand the principle of a navigation controller providing the framework for moving up and down a list but have not yet quite got my head around if you should have one navigation controller for the whole tree or several navigation controllers.
    In my app I need to have the following:
    Main view -> window view showing some interactive elements (picker, buttons etc.)
    Setup view -> Hierarchy managed by nav controller/table views
    The setup view needs to manage the following hierarchy...
    - Level A:
    - Global app variables (one table view)
    - Level B Items (table view showing list of items at belonging to Level B)
    - Level B Item 1 (table view showing list of items at level C belonging to level B item 1)
    - Level C Item 1 (table view showing list of items at level D belonging to level C item 1)
    - Level D Item 1 (table view showing list of items at level E belonging to level D item 1)
    - Level E item (table view for properties of item at Level E)
    - Level D Item n
    - Level C Item n
    - Level B Item n
    Each level in this has some properties and then a list of child items.
    What would be the best way of structuring this? I would assume that creating a class that extends a view controller for each level is a given but what about the control of the navigation? Should this be handled by one navigation controller or one per level? I think I know the right answer but have not seen a neat way of implementing
    I think I am also best off having each level in it's own xib but, once again, am not 100% sure that this is the best design pattern.
    Many thanks in advance for any help/pointers!
    Cheers
    jez

    Hi Julian,
    I have struggled with the same questions you are addressing. On a previous project we tried to model based on packages, but during the course of the project we encountered some problems that grew overtime. The main problems were:
    1. It is hard to enforce rules on package assignments
    2. With multiple developers on the project and limited time we didn't have time to review package assignment
    3. Devopelers would click away warnings that an object was already part of another project and just continue
    4. After go-live the maintenance partner didn't care.
    So, my experience is is that it is a nice feature, but only from a high level design point of view. In real life it will get messy and above all, it doesn't add much value to the development. On my neew assignment we are just working with packages based on functional area and that works just fine.
    Roy

  • How to add a ViewController to a Navigation Controller?

    How to add a ViewController to a Navigation Controller, if it contains a TableView as root?
    I'm trying to add a UIViewController (AddProjectViewController) to a Navigation Controller (navigationController), which has a Tableview set as root, and it does not work.
    This is how I have the files setup: http://d.pr/y8rt
    The code is in ProjectsController.m - please help

    Hi Andrei, and welcome to the Dev Forum!
    andreipotorac wrote:
    I'm trying to add a UIViewController (AddProjectViewController) to a Navigation Controller (navigationController), which has a Tableview set as root, and it does not work.
    You didn't say what user action should bring up the next controller. But for example, if you want an instance of AddProjectViewController to be pushed onto the nav controller's stack when the user selects a row in the table, something like this should work:
    // ProjectsController.m
    #import "ProjectsController.h"
    #import "AddProjectViewController.h"
    @implementation ProjectsController
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    // Navigation logic may go here. Create and push another view controller.
    AddProjectViewController *nextController = [[AddProjectViewController alloc]
    initWithNibName:@"AddProjectViewController" bundle:nil];
    // Pass selected object info to the new view controller here. E.g.:
    // Project *project = [projectsArray objectAtIndex: [indexPath row]];
    // nextController.projectTitle.text = project.projectTitle;
    [self.navigationController pushViewController:nextController animated:YES];
    [nextController release];
    - Ray

  • The internal workings implicitly popping from Navigation Controller

    I'm just curious to how a Navigation Controller is working when you pop out from a child view to a parent view. The reason I'm asking is because I have this kind of set up:
    App Delegate:
    Creates Nav Controller and inits it with a Root View
    Root View:
    Just some table view that allows to drill down a row to "Second View" lets call it
    When I push the second view into the Nav's stack, it'll automatically create a back button to pop. I am noticing when I hit back, it displays the Root View but the view event methods, i.e. viewWillAppear, are not called. Why is this?
    Since this is the case, what is the best way for me to reload the table view's data when I do a pop?

    Hey Ray,
    Sorry for all the confusion previously. I didn't have my personal computer at work so I wasn't able to copy/paste the exact code snippets but I can assure you that my print logs are working correctly. I actually have figured out what my issue was and I'll present to you (and anyone else who have run into a similar problem) what my problem was and what I did to solve it.
    First of all, let me address your previous questions. I am creating my Nav controller and the root view in the app delegate via the applicationDidFinishLaunching method. So something like this:
    myViewController *vc = [[myViewController alloc] initWithNibName@"myViewController" bundle:nil];
    myNavController = [[UINavigationController alloc] initWithRootViewController:myViewController];
    This was not the issue. The issue stems from the design of my app.
    The *root view controller* is actually a view that acts as a *container for two other view controllers*. One of them a *UITableViewController that controls a UITableView*, and the other is a *UIViewController that controls a MKMapView*.
    The UITableView has the ability to drill down into another table view, which invokes some actions that updates the list from the first view. This all works fine as I'm seeing in my logs.
    The problem was when I pop back to the root view I don't see the list updated; this pop back I'm referring to is the "Back" UIBarButtonItem that gets prefabbed for me when I push something to the Nav controller's stack. From my logs, the UITableViewController's inherited method, viewWillAppear is not being invoked, therefore, the [self.tableView reloadData]; that I placed in there is not being called.
    For some reason, a light bulb went on in my head today to investigate the container's view controller! *What I found out was only the container view controller's view event methods was getting called*; so all the viewWillAppear, viewDidAppear, etc... that I did not previously implement wasn't getting called and not appearing in the logs.
    So now, in the container's view controller's viewWillAppear, I call the UITableViewController's viewWillAppear, and my UITableView's list gets updated. So it's all working perfectly now.
    Thanks!

  • [iPhone] - Add command to a navigation controller back button?

    I have a root navigation controller with a table view going to a normal view controller. The normal view controller plays a sound but I am wanting the sound to stop when the back button is pressed to go back to the root view. Currently, the sound will continue playing until it ends. Where do I put the code to stop the sound when the back button is pressed?
    Thanks!

    You could place it in the UIViewController delegate method - (void) viewWillDisappear:(BOOL)animated.

  • Navigation controller back button

    Hi i have a viewcontoller a) controlling a view with an nstimer.
    I want to suspend the timer if i switch to another viewcontroller b)
    which is fine, but i want to resume the timer when pressing the back button
    on the navigation controller.
    How do i either know when this button is pressed, or how do i know when my viewcontroller a) is active again.
    Please help me out folks.....

    troutfly wrote:
    or how do i know when my viewcontroller a) is active again.
    viewWillAppear
    For the button solution, you would need to create your own.

  • IPhone Navigation Controller Problem

    I started working on learning how to use the iPhone UINavigationController in my app, and so far I have a UIViewController subclass that I can create multiple instances of with a view from a .xib file and push onto the navigation controller stack. Everything works, including the back button, but the first pushed view controller doesn't have a back button, so once I push one view on, the first view is inaccessible. Every view controller from the third one on has the back button. Any idea why?

    Well, I finally solved it. Turns out I needed to give the root UIViewController a title, and all the back buttons appeared fine, with the "invisible" one gaining the title of the root controller. Interesting how the others appeared - I guess creating a UIViewController programatically without a title gives the back button pointing to it a default title of "Back".

  • Problem responding to view being popped from navigation controller

    I have a detail view controller which is pushed onto the application's navigation controller stack by a given parent controller. The user is able to select table values in the detail controller, which should update the parent controller when, and only when, the detail view is popped and the parent view is made visible again.
    Is there a way to do this? I couldn't see any appropriate methods in UIViewController which would be called when the child view is popped. I've tried to make the parent controller conform the UINavigationControllerDelegate protocol and provided an implementation for willShowViewController method, but this method doesn't seem to get called when the view is displayed.
    I'm not sure if I'm going about it the right way trying to implement the UINavigationControllerDelegate and there is a bug with my implementation, or there are better ways to go to implement this functionality, such as using a modal controller, etc.

    m_userName wrote:
    The user is able to select table values in the detail controller, which should update the parent controller when, and only when, the detail view is popped and the parent view is made visible again.
    I don't understand why you require the update to be made only when the detail controller is popped, since during the time the detail controller is on top of the stack, the controller underneath isn't visible. It's common practice to pass data to the previous controller any time before the top controller is popped. Note that there's only a short interval between the time the top controller is removed from the stack and the time it's deallocated (unless you've retained that controller elsewhere, which should be avoided for best memory management).
    That said, [viewDidDisappear:|http://developer.apple.com/library/ios/documentation/UIKit/R eference/UIViewControllerClass/Reference/Reference.html#//appleref/doc/uid/TP40006926-CH3-SW20] is called during that interval, so I think it would be a good choice for the requirement you described:
    - (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
    if (self.navigationController == nil) {
    NSLog(@"%s: *POPPED* level=%d", _func_, level);
    // pass the data here
    The test for a nil navigationController pointer tells us whether the controller is actually off the stack when viewDidDisappear: runs. This is useful in case an instance of this controller class ever pushes another controller on top of it, since viewDidDisappear: will run in that situation as well. But in that case the controller doing the pushing remains on the stack, so its navigationController property won't be nil. If that property is nil when viewDidDisappear: runs, we know self has just been popped.
    You can also find the above example in [Problem with text in detailTextLabel of UITableViewCell |http://discussions.apple.com/message.jspa?messageID=12495708#12495708], so if you build the code in that thread you can see how things work together.
    - Ray

  • XCode4.6 Adding Navigation controller in Tab Bar

    Hi All,
         Iam a beginner in IOS development.
    I have installed XCode4.6 in Mac OS X Lion.
    As a part of my project, I started implementing navigation controller in Tab Bar.
    So I created a project with template as "Tab Bar Application".
    Then I created "FirstView" derived from UIViewController.
    Modified the AppDelegate.m as below:
    When I run the application, two tabs are displayed: "First" and "MyCutomView"
    First is the title of the FirstViewController that the template created by default.
    "MyCustomView" is the title of my custom navigation controller.
    When I click the tab "MyCustomView" Iam getting the following exception:
    In main() ---> @autoreleasepool ---> return statement. The xception message says "Thread 1: SIGNAL SIGABRT"
    Is anything Iam doing wrong?
    Is this feature not supported in XCode4.6?
    Looking forward for your guidance,
    Vidhya

    Hi,
    does the nib-file of ViewController "FirstView" really is called "Navigation Controller"?
    Dirk Mika

  • IPhone Dev: Tab Bar Controller with nested Navigation Controller

    I want to have a tab bar with 2 views. The first view is a navigational one. I know the view can be loaded in from an external nib and I can set the first view to a navigation controller.
    My question is: can this navigation controller in the external nib instead? Ideally I want to separate it out so the tab bar loads in the external nib (that has the navigation controller). Is this possible? or the only approach is to simply have to set the view controller to a navigation controller?

    Hey, this writing an app that uses the Tab View Controller in conjunction with Navigation View Controllers is driving me bats. I took a sample program which worked well, added a nib file for a basic view that only had a label on it then:
    * I created a view controller class to work with it.
    * I added code to add create a navigation controller.
    * Added my new view controller to the navigation controller
    * added this nav controller to the array with the other stuff for the tab view controller.
    * RUN
    Everything seems to work as far as all the existing stuff. And the title for my new "tab" shows up on the More tab.
    But when I click on it (in the simulator) the program crashes. It could be how I set up the nib file I made is wrong.
    I posted the code on my web site. Here is the URL:
    http://chomer.com/iphonesample_code/05a_-_Brightness_ToolbarSwatches.zip
    Please have a look. Its probably something small and stupid that I missed.
    Regards,
    Orville

  • [iphone beta 6] rotating with a navigation controller

    ok... this started happening in beta 6.
    i have a navigation controller. when i rotate the device to landscape, the view that it is on only gets half the screen vertically, when i rotate it back to portrait, the view only gets half horizontally.
    i have had many problems with rotating the device in the past, so it is likely that one of my workarounds i implemented then has not come back to bite me.
    manually setting the top view's frame with:
    navController.topViewController.view.frame = [self getScreenRect];
    does nothing
    any ideas?
    john
    Message was edited by: johne-dm

    just some debugging ideas.
    skip the nav controller and just have that top controller as the current view controller. see if you get the same behavior. then you know that it's not the nav controller.
    check the autoresizemask property of the top view controller's view. it should be set to expand vertically/horizontally as necessary.
    something that's helped me in the past is to set different backgroundColors for all view controller views.

  • Asynchronous connection navigation controller problem

    Hi,
    I have a view where I download some data from my server in an asynchronous way. Here is my viewWillAppear method:
    -(void)viewWillAppear:(BOOL)animated {
       NSURL *url = [NSURL URLWithString:kAuthenticationCheckURL];
       NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
        [request setHTTPMethod:@"POST"];
        NSString *strPostData = [NSString stringWithFormat:@"device_id:%@",device_id];
        NSData *requestBody = [strPostData dataUsingEncoding:NSUTF8StringEncoding];
        [request setHTTPBody:requestBody];
        NSURLConnection *conn=[[NSURLConnection alloc] initWithRequest:request delegate:self];
       if (conn) {
            [self.view setUserInteractionEnabled:FALSE];
            [actAuthentication startAnimating];
            receivedData = [[NSMutableData data] retain];
        } else {
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Sorry!" message:@"Connection to the server failed!" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil];
            [alert show];
            [alert release];
    Now once the data is loaded and the connectionDidFinishLoading method gets called, I want to navigate onto the new view controller (depending on the data received from the server. Here is my piece of code to do this:
    - (void)connectionDidFinishLoading:(NSURLConnection *)connection{
        [self.view setUserInteractionEnabled:TRUE];
        [actAuthentication stopAnimating];
        NSString *strAuthenticated = [[NSString alloc] initWithData:receivedData encoding:NSASCIIStringEncoding];
        NSLog(@"Authentication check response: %@",strAuthenticated);
        if (![strAuthenticated isEqualToString:@"YES"]) {
             Authentication1 *vcAuthentication = [[Authentication1 alloc] initWithNibName:@"Authentication1" bundle:[NSBundle mainBundle]];
             [self.navigationController pushViewController:vcAuthentication animated:YES];
             [vcAuthentication release];
        [connection cancel];
        [connection release];
    Now if the response from the server is something other than "YES", then the new view should be pushed into the navigation controller. But that is not happening. I tried to debug and found that the new VC is created and pushed successfully but is never visible. Perhaps its something to do with the thread as I read that asynchronous calls are made in s seperate thread.
    Looking forward for some suggestions.
    Regards,
    Obaid

    One more thing, I tried to check if the control really reaches the viewDidAppear and viewWillAppear methods of the new view (i.e. Authentication1)and it successfully reaches both these delegate methods of the new view. It means that somehow the new view is being created and pushed succesfuly but don't know why its not visible.
    Regards,
    Obaid

  • Navigation controller bar on the top of the view

    hi, im trying to figure out how to put navigation controller bar on the top of main view. currently view shows up right after the navigation bar. i want view to take full screen size and navigation controller on the top, so that i can make the navigation controller transparent... any idea? thanks

    That is the Navigation toolbar; be sure it is checked (click it to check or un-check) so that it will display following these instructions:
    *See --> https://support.mozilla.com/en-US/kb/Back%20and%20forward%20or%20other%20toolbar%20items%20are%20missing
    '''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.'''
    Not related to your question, but...
    You may need to update some plug-ins. Check your plug-ins and update as necessary:
    *Plug-in check --> http://www.mozilla.org/en-US/plugincheck/
    *Adobe Shockwave for Director Netscape plug-in: [https://support.mozilla.com/en-US/kb/Using%20the%20Shockwave%20plugin%20with%20Firefox#w_installing-shockwave Installing ('''''or Updating''''') the Shockwave plugin with Firefox]
    *Adobe PDF Plug-In For Firefox and Netscape: [https://support.mozilla.com/en-US/kb/Using%20the%20Adobe%20Reader%20plugin%20with%20Firefox#w_installing-and-updating-adobe-reader Installing/Updating Adobe Reader in Firefox]
    *Shockwave Flash (Adobe Flash or Flash): [https://support.mozilla.com/en-US/kb/Managing%20the%20Flash%20plugin#w_updating-flash Updating Flash in Firefox]
    *Next Generation Java Plug-in for Mozilla browsers: [https://support.mozilla.com/en-US/kb/Using%20the%20Java%20plugin%20with%20Firefox#w_installing-or-updating-java Installing or Updating Java in Firefox]

  • Question about view/controller/nib class design

    Assume you need to make an application with, let's say, 15 different views in total. There are two extreme design choices you can use to implement the app:
    1) Every single view has its own view controller and a nib file. Thus you end up with 15 controller classes and 15 nib files (and possibly a bunch of view classes if any of your views needs to be somehow specialized).
    2) You have only one controller which manages all the views, and one nib file from which they are loaded.
    AFAIK Apple and many books recommend going purely with option #1. However, going with this often results in needless complexity, large amounts of classes (and nib files) to be managed and complicated class dependencies, especially if some of the views (and thus their controllers) interact with each other or share something (something which would be greatly simplified if all these related views were handled by one single controller class).
    Option #2 also usually ends up being very complex. The major problem is that the single controller will often end up being enormous, handling tons of different (and usually unrelated) things (which is just outright bad design). This is seldom a good design, unless your application consists of only a few views which are closely related to each other (and thus it makes sense for one single controller class to handle them).
    (Option #2 also breaks the strictest interpretation of the MVC pattern, but that's not really something I'm concerned about. I'm concerned about simple design, not about following a programming pattern to the letter.)
    A design somewhere in between the two extremes often seems to be the best approach. However, since I don't have decades of Cocoa programming experience, I would like to hear some opinions about this subject matter from people with more experience on that subject. (I do have object-oriented programming experience, but I have only relatively recently started programming for the iPhone and thus Cocoa and its design patterns are relatively new to me, so I'm still learning.)

    Somehow I get the feeling that my question was slightly misunderstood.
    I was not asking "which one of these two designs do you think is better, option #1 or option #2?" I already said in my original post that option #2 is bad design (unless your application consists of just one or two views). That's not the issue.
    The issue is that from my own experience trying to adhere very strictly to the "every single view must have its own view controller and nib file" often results in needless complexity. Of course this is not always the case, but sometimes you end up having controller classes which perform very similar, if not even the exact same actions, resulting in code repetition. (An OO'ish solution to this problem would be to have a common base class for these view controllers where the common functionality has been grouped, but this often just adds to the overall complexity of the class hierarchy rather than alleviating it.)
    As an example, let's assume that you have a set of help screens (for example one help screen for each major feature of the app) and a view where you can select which help view to show. Every one of these views has, for example, a button to immediately exit the help system. If you had one single controller class managing these views, this becomes simpler: The controller can switch between any of the views and the buttons of each view (most of them doing the same things) can call back actions on this controller (eg. to return to the help selection or to exit the help screen completely). These help screens don't necessarily have any functionality of their own, so it's questionable what do they would need view controllers of their own. These view controllers would basically be empty because there's nothing special for them to do.
    View controllers might make it easy to use the navigation controller class, but the navigation controller is suitable mainly for utility apps but often not for things like games. (And if you need animated transitions between views, that can be implemented using the UIView animation features.)
    I also have hard time seeing the advantages of adhering strictly to the MVC pattern. The MVC pattern is useful in things like web servers, where MVC adds flexibility. The controller acts as a mediator between the database and the user interface, and it does so in such an abstract way that either one can be easily changed (eg. the "view", which normally outputs HTML, could be easily changed to a different "view" which outputs a PDF or even plain text, all this without having to touch the controller or the model at all). However, I'm not seeing the advantages of the MVC pattern in an iPhone app. It provides a type of class design, but why is it better than some other class design? It's not like the input and output formats of the app need to be changed on the fly (which is one advantage of a well-designed program using the MVC pattern).

  • UINavigationBar not displaying items for root view controller

    Hi,
    I've stumbled on something that has me completely stumped.
    This works: Add a UINavigationItem and UIBarButtonItems to a .xib (linking up the necessary outlets), push the view controller on to a navigation controllers stack. Result: You see the title and buttons on the nav bar correctly displayed.
    This doesn't work: Repeat the same process, but put these items in the root view controller of a navigation controller.
    The fix: Disconnect the UINavigationItem from the root view controllers "File's Owner" navigationItem outlet, override viewDidLoad in the root view controller class; and programatically set the items there.
    What am I missing? Why does the technique for configuring nav bar items work for additional view controllers pushed on to an existing navigation controllers stack, but not if the view controller is the root view controller? I have a sample project demonstrating this if this doesn't make sense!
    Thanks

    Hi,
    I've stumbled on something that has me completely stumped.
    This works: Add a UINavigationItem and UIBarButtonItems to a .xib (linking up the necessary outlets), push the view controller on to a navigation controllers stack. Result: You see the title and buttons on the nav bar correctly displayed.
    This doesn't work: Repeat the same process, but put these items in the root view controller of a navigation controller.
    The fix: Disconnect the UINavigationItem from the root view controllers "File's Owner" navigationItem outlet, override viewDidLoad in the root view controller class; and programatically set the items there.
    What am I missing? Why does the technique for configuring nav bar items work for additional view controllers pushed on to an existing navigation controllers stack, but not if the view controller is the root view controller? I have a sample project demonstrating this if this doesn't make sense!
    Thanks

Maybe you are looking for

  • Ability to use Adobe Photoshop Album tags in CS3 Bridge

    I currently have 15,250 photos and 155 tags entered in Adobe Photoshop album. I would like the ability to convert, import or somehow use these tags in CS3 Bridge without reentering everything. PLEASE!

  • Photo web gallery in dreamweaver - problem

    while creating a photo web gallery in dreamweaver (commands - create photo web album) an error occurs - when I browse pics by choosing my images folder, program says it's empty! It cant see the files! these are normal jpg and adding these pics worked

  • Upgrading from Acrobat 4.0 to 7.0

    Hi there. A customer of mine has recently upgraded their MS Office suite from 2000 to 2003 (running on XP) - you can't hurry these things! We have multiple versions of AA version 4.0 and want to move to version 7.0 for compatibility and integration w

  • PPro crashes for only one user

    We run Adobe CC 2013 on a Dell T7600, 32MB RAM, K5000 GPU. Lots of internal storage. Two identical systems have been running like a champ since 12/2013. Long story as to why we're on CC 2013. Suffice it to say it still runs great, except for one user

  • GetResources() gives null's after using RMI (ClassLoader problem???)

    Hi I have just put RMI into my app and it works fine, connects to a remote server, runs a method on the server and returns the results. The problem is when I try to use a line like: URL url = MyClass.class.getResources("image/save.gif"); The url is n