Layering Images in Interface View?

Discussion in 'iOS Programming' started by salvadormg, Aug 22, 2009.

  1. salvadormg macrumors member

    salvadormg

    Joined:
    Aug 19, 2009
    #1
    Hi,

    I want to create a view with a few pictures on it and words and text, but any time i put them near each other i just get errors everywhere... can anyone tell me how to fix this?? This is what i get....
     

    Attached Files:

  2. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #2
    Well, it doesn't want you to have sibling views that are one on top of another. You can make one view a subview of another view.

    BTW, I recommend that you don't put your project folder inside /Developer I have a develop folder inside my home folder and put project folders inside that.
     
  3. salvadormg thread starter macrumors member

    salvadormg

    Joined:
    Aug 19, 2009
    #3
    How do i do that may i ask... :confused::eek:



    Why is that? Works fine for me?
     
  4. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #4
    Hmm, my info window shows that issue as more of a warning (with an 'i' in a blue circle) than an error ('x' in a red circle). Regardless, you can probably just ignore it as long as things seem to be working ok. Wow, I didn't even know anybody really looked at that Document Info screen.
     
  5. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #5
    You can drag one view onto another view in the View window or you can do it in the nib windiw. Make sure the View Mode is set to list view in the nib window. You'll see all your views listed there in a hierarchical way. Just drag one view up and down the list to make it a subview of another view. There are a few kinds of views that don't allow having subviews. I think that UIImageViews is one of these.

    All those views that you show in the screenshot have to be inside another view object, right?

    There will come a day when you need to delete /Developer because your Xcode installation is fubar, or you just want to make sure to get a clean update when you get a new version of the SDK. If you have your projects inside there you might do something you'll regret. Or you do an install of a new version of Xcode and your project folders just vanish. /Developer belongs to Xcode. Put your projects somewhere else.
     
  6. salvadormg thread starter macrumors member

    salvadormg

    Joined:
    Aug 19, 2009
    #6
    i Still haven't gotten this working, does anyone no how to do this? I have a view, i put an image in the back, a few buttons, but if one button goes over the image i get an error that says illegal geometry! How do i fix this to layer up buttons and images?
     
  7. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #7
    As stated in the documentation for UIView (2nd paragraph, last sentence): "Sibling views are able to overlap without any issues, allowing complex view placement." So, just ignore it!
     
  8. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #8
    While I would try to minimize overlapping views if you need to place views on top of an imageview you're going to get these notices. I would probably ignore them also.

    You may need to set the severity of these issues in the IB prefs window to Note, and not Error.
     
  9. Darkroom Guest

    Darkroom

    Joined:
    Dec 15, 2006
    Location:
    Montréal, Canada
    #9
    is it because overlapping views reduces performance? i have several "complex" IB views, and a long list of illegal geometry notes to prove it. i just always ignored them since the programs always executed perfectly in both simulator and on device. i even receive illegal geometry notes for placing UILabels over UIImageViews, which never really made sense to me.

    so why would you discourage overlapping of views?
     
  10. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #10
    On Cocoa on the Mac the drawing order of sibling views is 'undefined' so the appearance of overlapping views is considered to also be undefined. On UIKit I guess this isn't the case.

    My reasons for trying to avoid this aren't well defined. Mostly I don't like to see errors or warnings if I can avoid it. I'll assume that there's a reason from Apple that they want views to be a certain size and to have a certain amount of space around them. Partly it's for appearance.

    In the case the OP describes where he wants controls on top of an image view I guess there's no other option. I can say in my code I have one case where I layer an activity indicator on top of other views in an overlapping manner. I don't have another way to display the indicator.

    As you know, Apple can change things at any time. They're more likely to change things that they've been giving warnings about.
     
  11. salvadormg thread starter macrumors member

    salvadormg

    Joined:
    Aug 19, 2009
    #11


    Has anyone gotten there App into the App store with these errors? Does Apple not care if there is an error on the views in an app? If so why the hell put them up?! I did also notice the App runs perfectly even with the errors i just prefer to send them off to Apple perfect with not one error! Guess thats just me?! :eek:
     
  12. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #12
    Yes. I know I have. In fact, I wouldn't be surprised if over 90% of the apps available out there have these kinds of "errors" (more on that later).

    Almost certainly not. I bet they are not even checking for these "errors" (more on that later).

    Just to bug you, I'm guessing. :D

    If your App runs perfectly, no worries, mate! Look, you have three options here: 1) learn to ignore them (i.e. don't even open that window anymore) and life will continue just as before (trust me), 2) change your Interface Builder preferences so that Illegal Geometry alerts are just Notice severity (somehow I think mine were always like this), or 3) re-do your UI so you have no overlapping siblings.

    Really, for iPhone development these are not "errors". Interface Builder really should just treat them like Notices and you should learn to ignore them unless they are causing you some related issues.
     

Share This Page