button not appearing on XIB

Discussion in 'iOS Programming' started by Kapthehat, Aug 27, 2013.

  1. Kapthehat macrumors member

    Joined:
    Jul 1, 2013
    #1
    Hello,

    The answer to this must be simple - but I cant see it !! I have a XIB with a button on it (there is also a single picker on it). However when I build and run my app, the button does not appear on the simulator (but the picker does).

    Any thoughts ? Thanks

    Regards

    Kaps
     
  2. dantastic macrumors 6502a

    dantastic

    Joined:
    Jan 21, 2011
    #2
    do a product > clean in xcode and remove the app from your phone.

    The xib is not in a subproject or in another project in the workspace?
     
  3. Duncan C macrumors 6502a

    Duncan C

    Joined:
    Jan 21, 2008
    Location:
    Northern Virginia
    #3
    Here is a possibility:

    Watch your "struts and springs" (resize masks) or your auto-layout rules, if you're using auto-layout.

    If you have the button near the bottom of the screen, and you are laying out your form on the default iPhone 5 screen layout, it needs to be anchored to the bottom of the screen. If the button is anchored to the top of the screen instead, when the system resizes your view to iPhone 4 size, the button will be off-screen.
     
  4. Kapthehat thread starter macrumors member

    Joined:
    Jul 1, 2013
    #4
    Thanks- I have done a product >clean and i still does not appear.

    I am a newbie - still working on the simulator - how do I remove it from the simulator ? As I mentioned, there is a picker on the xib which does appear - but not the button - so I am not sure of the relevance of sub projects.

    regards

    Kaps
     
  5. dantastic macrumors 6502a

    dantastic

    Joined:
    Jan 21, 2011
    #5
    Duncan might be on to something. Stick this into the viewdidload of the viewcontroller where you recon you should have a button
    Code:
    	for (UIView *view in self.view.subviews) {
    		NSLog(@"%@ %@", [view class], NSStringFromCGRect(view.frame));
    	}
    
    It should tell you where your button is, if there at all.
     
  6. Duncan C macrumors 6502a

    Duncan C

    Joined:
    Jan 21, 2008
    Location:
    Northern Virginia
    #6
    To remove an app from the simulator, go to the springboard and long press on the app icon just like you would on the device. Then click the X (iOS <7) or drag up (iOS 7) to delete the app.

    Under Xcode 4.6.3 lately, I've had to both clean the project and delete it from the simulator before changes to certain files actually get installed in my app on the simulator. This seems like a step backwards, although I haven't figured out the sequence that causes it yet.
     
  7. Kapthehat thread starter macrumors member

    Joined:
    Jul 1, 2013
  8. Tander macrumors 6502a

    Tander

    Joined:
    Oct 21, 2011
    Location:
    Johannesburg, South Africa
    #8
    Did you solve your problem?
     
  9. Kapthehat thread starter macrumors member

    Joined:
    Jul 1, 2013
  10. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
  11. Kapthehat thread starter macrumors member

    Joined:
    Jul 1, 2013
  12. Duncan C macrumors 6502a

    Duncan C

    Joined:
    Jan 21, 2008
    Location:
    Northern Virginia
    #12
    Please read the thread on marking posts as resolved, and mark your question as resolved.
     

Share This Page