I'm creating a number of static custom UITableViewCells
and have dragged a UISegmentedControl
onto one of the custom cells.
Whilst the segmented control allows me to alter its width I cannot alter its height in Interface Builder (that property is greyed out on 44 in the 'size' section of the property inspector).
I know that a UISegmentedControl
can be crated with a custom height in code and added to a UITableViewCell. Is there any way to adjust the height of the segmented control in Interface Builder?
You can indirectly change it when you pin the "Height" in Interface Builder (select the segment control then via the menu select
Editor -> Pin-> Height
).This will add a new Height constraint to the list of constraints for that control which you can then edit. Changes directly reflect in InterfaceBuilder as you can see in the Screenshot below.
No, it must be done in code. See this question.
To do it inside Interface Builder you can select the control and add frame attribute under "User Defined Runtime Attributes"
I'm not sure in IB, but you could always find the cell in your code and programmatically adjust its UISegmentedControl's height.
You can also open the
xib
file in any text editor, like Dashcode or MacVim or TextEdit - it's an XML. Then find your element there, in my case it looked like:Then you can change the
44
into whatever height you want - you'll see the changes in IB.This works for all elements that can't be changed height in IB -
UIPicker
also...We can set autolayout and then set height, After that we can off autolayout. so It will help for other then ios 6.0 .