Image not appearing on Viewcontroller

Discussion in 'iOS Programming' started by akaash1087, Jul 26, 2012.

  1. akaash1087 macrumors newbie

    Jul 7, 2010
    I am actually working on an splitview application.In one of the screens(Detailviewcontroller) I have a button which on clicking should launch a viewcontroller.Due to navigation requirements I have launched navigationcontroller (which has this viewcontroller as its Rootviewcontroller)
    I have used PresentModalViewcontroller(navigationcntroller,true);
    The problem is that there is an image on my viewcontroller which I want to display but it just doesnt appear when I run the app.I have configured an imageview using Interface builder and attached an image,the way it is done normally.
    For experimenation ,I have attached number of other controlls like buttons,labels to see whether they appear or not and they do.Image view is the only thing that does not appear.
    I just cant understand what is happening....
    Is it that PresentModalViewcontroller being deprecated does handle things properly??
    Actually I have used it a number of times in the past and it worked fine.
    Is it permissible to to display an image on VC when it is presented modally.
    I have actually set ModalTransitionStyle as FlipHorizontal
    and UIModalPresentationStyle as CurrentContext .
    Has that got something to do with this??
    I repeat that all the controlls are visible like labels,buttons.Imageview is the only thing that is not appearing.

    Any help would be highly appreaciated..
  2. jnoxx macrumors 65816


    Dec 29, 2010
    Aartselaar // Antwerp // Belgium
    One thing though, are you building on Simulator or on device? ;)
    Did you do a log of subviews?

    try this
     NSLog(@"show my subviews: %@", self.view.subviews);
    Put that in the viewDidLoad (this means your XIB got initialised).
    It will show all the subviews your view has, if it has the imageview, but no real image, it might be hidden below something or like I said, the capitalisation of your image is wrong, that's why it can't find it on the device (on simulator it doesn't care about capitalisation), so @"myImage.png", is not the same as "MyImage.png", the first will work on both if your image is really called like that, but the last will only work on the simulator if your image is really named myImage.png..

    Hope that helped.

  3. akaash1087 thread starter macrumors newbie

    Jul 7, 2010
    thx for taking out time..
    Actually , I am doing it on simulator .I have taken care not to capitalise names.As per your suggestion I equated the my view's subview property to an Uiview array and then debugged it.I found that the array does contain image(apart from the other things)
  4. jnoxx macrumors 65816


    Dec 29, 2010
    Aartselaar // Antwerp // Belgium
    Did you use exactly my code? or did you make your own array?
    Did you try creating an IBOutlet? and checking that pointer if it exists? :)

  5. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    Most likely the problem is the image, not the imageView. How do you set the image for the imageView? Show the code.
  6. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    There might not be any code. The image might be set via the Image attribute within IB.

Share This Page