ios - How to set UISegmentedControl frame? -
here code:
uisegmentedcontrol *segmentedcontrol = [[uisegmentedcontrol alloc] initwithitems:items]; segmentedcontrol.frame = cgrectmake(0.0, 0.0, 320.0, 30.0);
the result segmentedcontrol has 10 pts margin left , top.
i try change params of frame cannot change x position. has 10 pt margin left. how remove margin?
edit
i figure out
uitoolbar has 10pt margin. if add uisegmentedcontrol, display correctly.
you can't change height of uisegmentedcontrol
because height fixed uisegmentedcontrol
based on style
for plain , borderd style height 43 , bar style height 29.
uisegmentedcontrol *segmentedcontrol = [[uisegmentedcontrol alloc] initwithitems:items]; segmentedcontrol.frame = cgrectmake(0.0, 0.0, 320.0, 29.0); segmentedcontrol.segmentedcontrolstyle = uisegmentedcontrolstylebar;
set uisegmentedcontrolstylebar in segmentedcontrolstyle
property of uisegmentedcontrol
.
Comments
Post a Comment