UIBarButtonItem *refresh = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(refreshClicked:) ];
UIBarButtonItem *flex = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
NSArray *statusItems = [[NSArray alloc] initWithObjects:@"Girls",@"Boys", nil];
UISegmentedControl *bottomSegmentBar = [[UISegmentedControl alloc] initWithItems:statusItems];
bottomSegmentBar.segmentedControlStyle=UISegmentedControlStyleBar;
[bottomSegmentBar addTarget:self action:@selector(segmentBarClicked:) forControlEvents:UIControlEventValueChanged];
UIBarButtonItem *SegmentItem = [[UIBarButtonItem alloc] initWithCustomView:bottomSegmentBar];
NSArray *toolbarItems = [[NSArray alloc] initWithObjects:flex,SegmentItem,flex,refresh,nil];
Toolbar.items = toolbarItems;
Is segmented control in your app vertically centered? I have similar code, but segmented control's origin.y automatically set to 8, so it is 1px shifted down. But I need to center it.
ReplyDelete