Mike D
Mike D

Reputation: 4946

UIButton is Filling Screen

I have a problem where the button's I have added to .xib file are filling the screen when I run the application in the iPhone simulator. In Interfacce Builder, the UI appears exactly as I want it. It is added in Interface Builder, and it is correctly linked to the proper view controller. The button is not being manipulated in the code. Code someone point out some settings to check. This is an error that has been there for a few and days, and I can't seem to fix it.

The view hierarchy is (if this helps):

MainWindow
    TabController
        FirstView
        SecondView
        ThirdView

In FirstView.xib, in the document outline under objects, there is a root view, which contains the UIButton in question.

Upvotes: 0

Views: 151

Answers (2)

Sierra Alpha
Sierra Alpha

Reputation: 3727

One possibility is that the button is added as the view, instead of a subview of the view. It sometimes happens, when you move a button around -- particularly from within the hierarchy list, it accidentally becomes the view (of the viewController) instead of be a subview.

Upvotes: 2

spacebiker
spacebiker

Reputation: 3875

Most probably is that you have not configured correctly the resizing of the button. You can either set it in code or using the interface builder.

For the interface builder solution select the button and open the "Size Inspector". You will see that there is an autosizing feature, adjust to your need and you are done.

Upvotes: 2

Related Questions