开发者

Interface Builder - Custom Button with Title text

When I set up a custom 开发者_开发问答button in Interface Builder it hides the Title text.

Do you have to create the text for the button too or is it possible to change the Z order so that the Title appears on top?


You are probably setting the 'Image' property of your button instead of the 'Background' property. 'Image' appears over your text, so either programmatically or in NIB(way simpler), set the 'Background' image to your desired png, and set the text for the desired button 'State Config'(default, selected etc), Leaving the 'Image' property blank.


The title by default appears on the top and in no case the text goes behind the button... Still follow the below steps 1. Drag uibutton to the view 2. Select UIButton 3. Click on the first tab of the Inspector 4. Then Enter the title over there.

The title entered will be on the button.. Hope this helps


For a custom button, I fixed the same problem by going in interface builder and in the tab where you can set up hte title, image, background, etc., if you look lower, there will be a section titled "Control". In that section you can change the alignment and there are also some checkboxes for "Content". Put a checkmark in "Enabled" and "Selected" and it should work. Ensure to have populated the title for the various states of the button.


It may be related to the State Config attribute. I had the same problem and solved it by doing this:

  1. Select your button
  2. In the utilities pane (right pane), select the Attribute inspector (4th tab).
  3. Change the State Config (2nd attribute) to the value "Default".
  4. Enter a Title and press Enter (I tried changing it directly on the button but it is resized automatically).
  5. You may switch back to your previous State Config if it is what you need.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜