Note that there are some explanatory texts on larger screens.

plurals
  1. POUIToolbar with abnormally fat UISegmentedControl
    primarykey
    data
    text
    <p>I've never added a segmented control to a bottom toolbar without Interface Builder. I added the same segmented control to the navigation control toolbar without this issue. What am I doing wrong? Thank you. </p> <p><img src="https://i.stack.imgur.com/WxwN2.png" alt="a screenshot of what im getting"></p> <pre><code>//enable UIToolbar self.navigationController.toolbarHidden = NO; //UISegmentedControl NSArray *segmentedControlItems = [[NSArray alloc] initWithObjects:@"Day One",@"Day Two",nil]; self.segmentedCon = [[UISegmentedControl alloc] initWithItems:segmentedControlItems]; [segmentedControlItems release]; [self.segmentedCon addTarget:self action:@selector(daySegConIndexChange) forControlEvents:UIControlEventValueChanged]; [self.segmentedCon setSelectedSegmentIndex:0]; [self.segmentedCon setSegmentedControlStyle:UISegmentedControlStyleBar]; [self.segmentedCon setWidth:85.0 forSegmentAtIndex:0]; [self.segmentedCon setWidth:85.0 forSegmentAtIndex:1]; [self.segmentedCon setFrame:[self.navigationController.toolbar bounds]]; //bar button items UIBarButtonItem *flexibaleSpaceBarButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; UIBarButtonItem *segBarBtn = [[UIBarButtonItem alloc] initWithCustomView:self.segmentedCon]; //nsarray of tool bar items NSArray *toolbarItems = [NSArray arrayWithObjects:flexibaleSpaceBarButton,segBarBtn,flexibaleSpaceBarButton,nil]; [self setToolbarItems:toolbarItems animated:YES]; [segBarBtn release]; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload