I have a UIToolBar that is intended to contain sliders for controlling volume and brightness. I use a MPVolumeView slider for the volume, and an ordinary UISlider for the brightness. While the sliders themselves work fine, their vertical positions are mismatched:
How do I get them to be on the same height?
My code:
- (void) createToolbar{
toolBar = [[UIToolbar alloc] init];
toolBar.frame = CGRectMake(0, 0, self.view.frame.size.width, 44);
UISegmentedControl *modeSelector = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:#"Play", #"Rec", nil]];
[modeSelector setSegmentedControlStyle:UISegmentedControlStyleBar];
[modeSelector addTarget:self action:#selector(changePlayMode) forControlEvents:UIControlEventValueChanged];
modeSelector.selectedSegmentIndex = 0;
UIBarButtonItem *modeSelectorAsToolbarItem = [[UIBarButtonItem alloc] initWithCustomView:modeSelector];
brightnessSlider = [[UISlider alloc] initWithFrame:CGRectMake(0, 0, 150, 30)];
brightnessSlider.minimumValue = 0;
brightnessSlider.maximumValue = 1;
brightnessSlider.value = [[UIScreen mainScreen] brightness];
brightnessSlider.continuous = YES;
[brightnessSlider addTarget:self action:#selector(adjustBrightness:) forControlEvents:UIControlEventValueChanged];
UIBarButtonItem *brightSliderAsToolbarItem = [[UIBarButtonItem alloc] initWithCustomView:brightnessSlider];
MPVolumeView *volView = [[MPVolumeView alloc] initWithFrame:CGRectMake(0, 0, 150, 30)];
volView.showsRouteButton = NO;
UIBarButtonItem *volSliderAsToolbarItem = [[UIBarButtonItem alloc] initWithCustomView:volView];
UIBarButtonItem *flexibleSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
UIBarButtonItem *toc = [[UIBarButtonItem alloc] initWithTitle:#"Contents" style:UIBarButtonItemStyleBordered target:self action:#selector(goToToC)];
[toolBar setItems:[NSArray arrayWithObjects:modeSelectorAsToolbarItem, flexibleSpace, brightSliderAsToolbarItem, volSliderAsToolbarItem, flexibleSpace, toc, nil] animated:NO];
toolBar.autoresizingMask |= UIViewAutoresizingFlexibleWidth;
[[self view] addSubview:toolBar];
}
(Changing the CGRectMake coordinates doesn't seem to do anything.)
A comment in the question "Custom MPVolumeView Thumb Image not vertically centered since iOS 5.1" seemed to suggest using the "Fixing thumb alignment" trick explained here, but implementing that code didn't seem to do anything as far as I could tell, and I'm not sure whether it was talking about the same problem.
If you create a trivial subclass of MPVolumeView and override volumeSliderRectForBounds:, you can define your own alignment for the slider rect. I like to return the whole bounds, which centers the slider in the MPVolumeView's frame
#interface KMVolumeView : MPVolumeView
#end
#implementation KMVolumeView
- (CGRect)volumeSliderRectForBounds:(CGRect)bounds
{
return bounds;
}
#end
Just use your subclass in code or in interface builder and you can then reliably position the volume view.
I came up with something, that extends kmikael's answer:
#interface SystemVolumeView : MPVolumeView
#end
#implementation SystemVolumeView
- (CGRect)volumeSliderRectForBounds:(CGRect)bounds {
CGRect newBounds=[super volumeSliderRectForBounds:bounds];
newBounds.origin.y=bounds.origin.y;
newBounds.size.height=bounds.size.height;
return newBounds;
}
- (CGRect) routeButtonRectForBounds:(CGRect)bounds {
CGRect newBounds=[super routeButtonRectForBounds:bounds];
newBounds.origin.y=bounds.origin.y;
newBounds.size.height=bounds.size.height;
return newBounds;
}
#end
This implementation differs in that it still uses the default horizontal values but overrides the vertical ones in order to keep the MPVolumeView centered vertically in its container. It also overrides -routeButtonRectForBounds: so that the airplay/route button gets centered as well.
I have to wonder why the default implementation has a wonky vertical position.
SWIFT Version:
come form hyperspasm's answer:
import Foundation
class SystemVolumeView: MPVolumeView {
override func volumeSliderRect(forBounds bounds: CGRect) -> CGRect {
var newBounds = super.volumeSliderRect(forBounds: bounds)
newBounds.origin.y = bounds.origin.y
newBounds.size.height = bounds.size.height
return newBounds
}
override func routeButtonRect(forBounds bounds: CGRect) -> CGRect {
var newBounds = super.routeButtonRect(forBounds: bounds)
newBounds.origin.y = bounds.origin.y
newBounds.size.height = bounds.size.height
return newBounds
}
}
I ended up just using UISlider for both, using the instructions provided in the "Get System Volume" and "Change System Volume" answers to make a volume slider instead of using MPVolumeView.
Related
I am trying to use a UISwitch in my UINavigationBar. I want a smaller switch than the default, so I am scaling the size down with anonymousSwitch.transform = CGAffineTransformMakeScale(0.55, 0.55); When I do this, the switch shrinks, but I cannot figure out how to align it vertically with the other elements in my UINavigationBar.
Here is what it looks like currently:
Ideally, the UISwitch would be spaced away from the 175 UILabel as much as the X UIButton is spaced from the 175 UILabel, and the UISwitch would be in a straight line with the rest of the elements in the UINavigationBar. I tried doing switch.center = CGPointMake(switch.center.x, shareButton.center.y), but this did not affect the placement of the UISwitch at all.
Is there any way for me to position the switch like I want?
I had the same problem.
I tried to solve it and came up with this solution.
I don't think it's a perfect solution and might not work on every iOS-Version.
First you need to subclass UISwitch like this:
#interface UICustomSwitch : UISwitch
#property (assign, nonatomic) CGFloat scale;
#end
#implementation UICustomSwitch
- (void)setFrame:(CGRect)frame {
CGFloat superview_height = self.superview.frame.size.height;
frame.origin.y = (superview_height - frame.size.height * _scale) / 2;
[super setFrame:frame];
}
#end
The second thing to do is to create and setup your UICustomSwitch like that:
UICustomSwitch* switch = [UICustomSwitch new];
switch.transform = CGAffineTransformMakeScale(0.75, 0.75);
switch.scale = 0.75;
UIBarButtonItem* button = [[UIBarButtonItem alloc] initWithCustomView:switch];
To create a bigger space between the 175 and the switch you could just add another UIBarButtonItem between the 175 and the switch. E.g. a fixed spacer with a specific width.
Like i said, i don't think it's a flawless solution.
In my tests it worked.
Another solution by 0yeoj (but a little bit adjusted -> always centered for every navigationBar height, for toolbars it's the same, just use self.navigationController.toolbar.frame.size.height ):
UIView* switch_container = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 44, self.navigationController.navigationBar.frame.size.height)];
UISwitch* switch = [[UISwitch alloc] initWithFrame:switch_container.bounds];
switch.transform = CGAffineTransformMakeScale(0.75, 0.75);
switch.center = CGPointMake(switch_container.bounds.size.width/2, switch_container.bounds.size.height/2);
[switch addTarget:self action:#selector(action:) forControlEvents:UIControlEventValueChanged];
[switch_container addSubview:switch];
UIBarButtonItem* button = [[UIBarButtonItem alloc] initWithCustomView:switch_container];
self.navigationItem.rightBarButtonItem = button;
Have you tried moving switch with another transform method like,
CGAffineTransformMakeTranslation(xValue, yValue);
also you can merge two transform together and give that transform to switch like,
CGAffineTransform scale= CGAffineTransformMakeScale(0.55, 0.55);
CGAffineTransform translate = CGAffineTransformMakeTranslation(0, 10);
anonymousSwitch.transform = CGAffineTransformConcat(scale, translate);
This is the code i tested..
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
UIButton *xbutton = [UIButton buttonWithType:UIButtonTypeCustom];
xbutton.frame = CGRectMake(0, 6, 35, 35);
xbutton.backgroundColor = [UIColor redColor];
UIView *containerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 44, 44)];
UISwitch *switchButton = [[UISwitch alloc] init];
switchButton.frame = CGRectMake(0, 0, 35, 35);
switchButton.transform = CGAffineTransformMakeScale(0.55, 0.55);
switchButton.center = CGPointMake(containerView.frame.size.width/2, containerView.frame.size.height/2);
[containerView addSubview:switchButton];
UIBarButtonItem *additionalButton = [[UIBarButtonItem alloc] initWithCustomView:containerView];
UIBarButtonItem *xBarButton = [[UIBarButtonItem alloc] initWithCustomView:xbutton];
//rearrange it if necessary
NSArray *arrayButton = [NSArray arrayWithObjects: xBarButton, additionalButton, nil];
self.navigationItem.leftBarButtonItems = arrayButton;
}.
hmm... i haven't DOWNGRADED yet to yosemite so i dont have ios8.3 here this code works perfectly for me though..
What is the proper way to change height of navigation bar?
I need to create custom title in navigation bar, it should contains two UILabels one above other. The Title should be resized to fit those UILabels.
Should I override sizeThatFits: method in my custom TitleView, would other buttons correctly change to fit that size? How can I change a size of NavigationBar?
That is what I need to create using latest SDK features.
Create the following class category (you can create it in your implementation file):
#import "objc/runtime.h"
#interface UINavigationBar (CustomHeight)
- (void)setHeight:(CGFloat)height;
#end
static char const *const kHeight = "Height";
#implementation UINavigationBar (CustomHeight)
- (void)setHeight:(CGFloat)height
{
objc_setAssociatedObject(self, kHeight, #(height), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
- (NSNumber *)height
{
return objc_getAssociatedObject(self, kHeight);
}
- (CGSize)sizeThatFits:(CGSize)size
{
CGSize newSize;
if (self.height) {
newSize = CGSizeMake(self.superview.bounds.size.width, [self.height floatValue]);
} else {
newSize = [super sizeThatFits:size];
}
return newSize;
}
#end
And after that, simply call [self.navigationController.navigationBar setHeight:100.0] in your viewDidLoad or where you need it. Works in both iOS 7.1 and 8.1.
Disclaimer: Any alteration of the API and its functions is prone to future issues with new OS releases! Apple does not intend to allow us to change the navigation bar height (except for some rare instances) so use any solution wisely after assessing the risks vs advantages.
Looking at that design that you posted, I don't have the impression that the bar is really higher than the standard 44pt. Please note that starting with iOS7 the status bar is integrated into the same bar and the 20pt of the status bar is added to the total height.
IMHO, the only problem you need to solve is to stack the title/subtitle, and that can be easily done with a custom titleView, as Kampai has demonstrated.
Add custom view for both navigation title and navigation right bar button.
Here how you can add title view like above.
// Custom view for navigation title.
UIView *customTitleView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 44)];
UILabel *label1 = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 22)];
label1.text = #"Stasik";
label1.font = [UIFont fontWithName:#"HelveticaNeue-Light" size:20];
label1.textAlignment = NSTextAlignmentCenter;
[customTitleView addSubview:label1];
UILabel *label2 = [[UILabel alloc] initWithFrame:CGRectMake(0, 22, 100, 22)];
label2.text = #"Stasik iPhone";
label2.font = [UIFont fontWithName:#"HelveticaNeue-Light" size:16];
label2.textAlignment = NSTextAlignmentCenter;
label2.textColor = [UIColor darkGrayColor];
[customTitleView addSubview:label2];
self.navigationItem.titleView = customTitleView;
// Custom view for right navigation.
UIButton *upButton = [UIButton buttonWithType:UIButtonTypeCustom];
upButton.frame = CGRectMake(0, 0, 20, 44);
[upButton setImage:[UIImage imageNamed:#"up"] forState:UIControlStateNormal];
[upButton addTarget:self action:#selector(upButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *upButtonBarItem = [[UIBarButtonItem alloc] initWithCustomView:upButton];
UIButton *downButton = [UIButton buttonWithType:UIButtonTypeCustom];
downButton.frame = CGRectMake(0, 0, 20, 44);
[downButton setImage:[UIImage imageNamed:#"down"] forState:UIControlStateNormal];
[downButton addTarget:self action:#selector(downButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *downButtonBarItem = [[UIBarButtonItem alloc] initWithCustomView:downButton];
// Remove trailing space for right view.
UIBarButtonItem *nagativeSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
nagativeSpace.width = -11;
self.navigationItem.rightBarButtonItems = #[nagativeSpace, upButtonBarItem, downButtonBarItem];
// Left item
UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
backButton.frame = CGRectMake(0, 0, 40, 44);
[backButton setImage:[UIImage imageNamed:#"back"] forState:UIControlStateNormal];
[backButton addTarget:self action:#selector(backButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
// Remove leading space for left view.
nagativeSpace.width = -15;
UIBarButtonItem *backButtonBarItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
self.navigationItem.leftBarButtonItems = #[nagativeSpace, backButtonBarItem];
OutPut:
Arrow images are different than OP's requirement but it serves layout for navigation views.
From above code make change in nagativeSpace.width value to arrange buttons with accurate distance from left as well as right margins.
I want the toolbar to automatically appear on the bottom of the screen, and I want it to resize the width so it adjusts from iPhone to iPad. The code below results in a static UIToolbar which stays in the same position. How do i make the toolbar appear at the bottom, and how do i adjust the width automatically according to screen size ?
- (UIView*)commomOverlay
{
UIView* view = [[UIView alloc] initWithFrame:CGRectMake(0,0,400,430)];
CGRect rect = CGRectMake(0, [[UIScreen mainScreen] bounds].size.height - 44, [[UIScreen mainScreen] bounds].size.width, 44); /*
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
rect = CGRectMake(0,0,768,1004);
}
UIImageView *FrameImg = [[UIImageView alloc] initWithFrame:rect];
[FrameImg setImage:[UIImage imageNamed:#"newGraphicOverlay.png"]];
FrameImg.userInteractionEnabled = YES;
[view addSubview:FrameImg];
[FrameImg release];*/
rect = CGRectMake(0, 0, 400, 50);
UIToolbar *myToolBar = [[UIToolbar alloc] initWithFrame:rect];
[myToolBar setBarStyle:UIBarStyleBlackTranslucent];
UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithTitle:#"Finish" style:UIBarButtonItemStyleBordered target:self action:#selector(cancelButtonPressed)];
UIBarButtonItem *flexiSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:#selector(myFunction)];
mySwitch = [[UISwitch alloc] initWithFrame:CGRectMake (123,350,40,20)];
[mySwitch addTarget:self action:#selector(toggleFlash:) forControlEvents:UIControlEventAllTouchEvents];
UIBarButtonItem *switchBtn = [[UIBarButtonItem alloc] initWithCustomView:mySwitch];
//Order of how buttons appear or toolbar left to right.
[myToolBar setItems:[NSArray arrayWithObjects: cancelButton, flexiSpace,switchBtn, nil] animated:YES];
myToolBar.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight ;
[cancelButton release];
[flexiSpace release];
[switchBtn release];
[view addSubview:myToolBar];
return view;
}
You are setting it's frame using a constant value. However, your view's frame is already set at this point and it will not change according to your autoresizingMask. You should use the view's bounds property instead and do something like:
toolbar.frame = CGRectMake(self.view.bounds.origin.x, 0, self.view.bounds.size.width, 50);
Another option would be defining constraints for your view.
UI is programmatically generated in my app. I have few buttons and texboxes in the UI. I have developed a custom uidatapicker object, which pops up from the top and animates to the middle of the screen. When uidatapicker pops up I draw another UIView(called helper view) with the size of the screen so all other uiobjects in the screen except uidatepicker become disabled.
But when the UIDatePicker is animating a button in the UI jumps to another location. Also I have three buttons in my UI. It happens with only one button(one UIButon in the UIView). Other two buttons are ok. Also there is no significant difference between those buttons except the button text.
I removed the earlier described view(helper view), but still the
problem is occurring.
I need to know why this is occurring how to
prevent it.
Also I have lot of other pages which works fine.
The code
-(void)openEditDateTime:(UIDatePickerMode) mode {
if ([clientView viewWithTag:9]) {
[self cancelPressed];
}
CGRect toolbarTargetFrame = CGRectMake((clientView.frame.size.width/2)-160, (clientView.frame.size.height/2)+91, 320, 44);
CGRect datePickerTargetFrame = CGRectMake((clientView.frame.size.width/2)-160, (clientView.frame.size.height/2)-125, 320, 216);
backgroundView = [[UIView alloc] initWithFrame:clientView.bounds];
backgroundView.alpha = 0;
backgroundView.backgroundColor = [UIColor blackColor];
backgroundView.tag = 9;
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:#selector(cancelPressed:)];
[backgroundView addGestureRecognizer:tapGesture];
[clientView addSubview:backgroundView];
[self bringToFront:backgroundView];
datePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, self.bounds.size.height+44, 320, 216)];
datePicker.tag = 10;
datePicker.datePickerMode = mode;
[clientView addSubview:datePicker];
[clientView bringSubviewToFront:datePicker];
[datePicker becomeFirstResponder];
[self bringToFront:datePicker];
if(date != nil){
datePicker.date = date;
}
toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, self.bounds.size.height, 320, 44)];
toolBar.tag = 11;
toolBar.barStyle = UIBarStyleBlackTranslucent;
UIBarButtonItem *spacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:#selector(donePressed:)];
UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:#selector(cancelPressed:)];
[toolBar setItems:[NSArray arrayWithObjects:spacer, doneButton, cancelButton, nil]];
[clientView addSubview:toolBar];
[clientView bringSubviewToFront:toolBar];
[UIView beginAnimations:#"MoveIn" context:nil];
toolBar.frame = toolbarTargetFrame;
datePicker.frame = datePickerTargetFrame;
backgroundView.alpha = 0.5;
[UIView commitAnimations];
}
- clientView is a UIScrollView.
- backgroundView is the helper view described earlier.
This is how I add buttons. I wil put only a part of the button rendering code as putting all the code is unnecessary and it has lot other dependencies as well.
-(RenderedElement*)renderElement:(NSObject*)element:(ParentView*)parent:(PageView*)page:(Page*)modelPage:(RenderedElement*)parentRenderedElement {
UIButton *buttonView = nil;
Button *templateElement = nil;
buttonView = [UIButton buttonWithType:UIButtonTypeCustom];
[buttonView setLineBreakMode:UILineBreakModeWordWrap];
[buttonView addTarget:parent action:#selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside];
[parent addSubview:buttonView];
}
UPDATE
When I change the order of rendering and if I render the buttons first the jumping effect is not happening. The UI works fine. It temporally solves the problem. But I want find the reason and have a better solution.
Maybe you can add
[UIView setAnimationBeginsFromCurrentState:YES];
after
[UIView beginAnimations:#"MoveIn" context:nil];
Did you actually say which button is moving? Kind of hard to help without some more detail. But here are some suggestions to look at:
Rather than adding the datepicker to the bottom of the stack and then pulling it forward:
[clientView addSubview:datePicker];
[clientView bringSubviewToFront:datePicker];
Why don't you try to try adding it by:
[clientView insertSubview:datePicker atIndex:0];
Also, you are adding the toolbar, which I assume contains the offending button, after adding the datPicker and then pulling that forward. Do you want the toolbar to be above the datepicker in the view hierachy?
Perhaps insert it at:
[clientView insertSubview:toolBar aboveSubview:datePicker];
Finally, do you need to animate the toolbar frame?
The only thing i can imagine is that may be you have this button on the client view. and since you are adding and moving this
[clientView addSubview:datePicker];
[clientView bringSubviewToFront:datePicker];
this may cause readjusting of your UIButton's frame. and since that happens during this procedure it also animates its movement which may appear as a jumping button..so i guess you should try
[jumpingButton setAnimationsEnabled:NO]; //you-know jumping button is the outlet of the -you-know-who
I'm adding a UIPickerView to my view when a UILabel is tapped. When I was adding the UIPickerView by itself, it worked fine:
static const CGFloat HMCMeasurePickerHeight = 200.0;
CGRect measurePickerFrame = CGRectMake(0.0,
CGRectGetHeight(self.view.window.bounds) - HMCMeasurePickerHeight,
CGRectGetWidth(self.view.window.bounds),
HMCMeasurePickerHeight);
UIPickerView *picker = [[UIPickerView alloc] initWithFrame:measurePickerFrame];
picker.dataSource = self;
picker.delegate = self;
picker.showsSelectionIndicator = YES;
[self.view addSubview:picker];
However, I wanted a toolbar with it, so I wrapped it in a UIView:
static const CGFloat HMCMeasurePickerAccessoryHeight = 44.0;
static const CGFloat HMCMeasurePickerHeight = 200.0;
CGRect measurePickerSuperviewFrame = CGRectMake(0.0,
CGRectGetHeight(self.view.window.bounds) - HMCMeasurePickerHeight - HMCMeasurePickerAccessoryHeight,
CGRectGetWidth(self.view.window.bounds),
HMCMeasurePickerAccessoryHeight);
UIView *measurePicker = [[UIView alloc] initWithFrame:measurePickerSuperviewFrame];
CGRect measurePickerAccessoryFrame = CGRectMake(0.0,
0.0,
CGRectGetWidth(self.view.window.bounds),
HMCMeasurePickerAccessoryHeight);
UIToolbar *measurePickerAccessory = [[UIToolbar alloc] initWithFrame:measurePickerAccessoryFrame];
measurePickerAccessory.barStyle = UIBarStyleBlackTranslucent;
UIBarButtonItem *rightAlignSpacer = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
target:nil
action:nil];
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone
target:self
action:#selector(dismissMeasurePicker:)];
measurePickerAccessory.items = #[rightAlignSpacer, doneButton];
[measurePicker addSubview:measurePickerAccessory];
CGRect measurePickerFrame = CGRectMake(0.0,
HMCMeasurePickerAccessoryHeight,
CGRectGetWidth(self.view.window.bounds),
HMCMeasurePickerHeight);
UIPickerView *picker = [[UIPickerView alloc] initWithFrame:measurePickerFrame];
picker.dataSource = self;
picker.delegate = self;
picker.showsSelectionIndicator = YES;
[measurePicker addSubview:picker];
[self.view addSubview:measurePicker];
Now, when I attempt to scroll the UIPickerView nothing happens. I can successfully tap the Done button I added, it's just the UIPickerView that is not responding. I tried setting picker.userInteractionEnabled = YES but that had no effect (given the first example it seems like it defaults to YES).
I guess the issue is that frame size of
measurePicker is smaller than picker. I
would suggest you to check on this line.
NSLog the final frame of measurePicker
and see what width and height it
returns.