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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -