Note that there are some explanatory texts on larger screens.

plurals
  1. POBottom part of UISwitch is cut off on the device but displays normal on the Simulator
    primarykey
    data
    text
    <p>The UISwitch on my device: <a href="http://gorgando.com/uiswitch.jpg" rel="nofollow noreferrer">Switch Image with the bottom pixels cut off http://gorgando.com/uiswitch.jpg</a> </p> <p>The UISwitch on the simulator: <a href="http://gorgando.com/uiswitch-good.png" rel="nofollow noreferrer">Good UISwitch http://gorgando.com/uiswitch-good.png</a></p> <p>As you can see, the bottom pixels are cut off on the device, but not on the simulator. I have tried just about everything I can think of, but nothing has fixed the problem. </p> <p>Some of the things I've tried:</p> <ul> <li>Changing the UISwitch's frame's height</li> <li>Changing the UICell's height</li> <li>Changing the UICell's contentView's height</li> <li>Adding the UISwitch to the UICell rather than the UICell's contentView</li> </ul> <p>Here is the relevant code:<br> This is in the viewDidLoad of the uiTableViewController:</p> <pre><code>UISwitch *sw = [[UISwitch alloc] init]; self.contactedSwitch = sw; [sw release]; self.contactedSwitch = [UISwitch switchWithLeftText:@"YES" andRight:@"NO"]; self.contactedSwitch.center = CGPointMake(230, 22); self.contactedSwitch.on = [self.contact.contacted boolValue]; </code></pre> <p>This is where the switchWithLeftText:andRight method comes from: </p> <pre><code>#import "UISwitch-Extended.h" #define TAG_OFFSET 900 @implementation UISwitch (tagged) - (void) spelunkAndTag: (UIView *) aView withCount:(int *) count { for (UIView *subview in [aView subviews]) { if ([subview isKindOfClass:[UILabel class]]) { *count += 1; [subview setTag:(TAG_OFFSET + *count)]; } else [self spelunkAndTag:subview withCount:count]; } } - (UILabel *) label1 { return (UILabel *) [self viewWithTag:TAG_OFFSET + 1]; } - (UILabel *) label2 { return (UILabel *) [self viewWithTag:TAG_OFFSET + 2]; } + (UISwitch *) switchWithLeftText: (NSString *) tag1 andRight: (NSString *) tag2 { UISwitch *switchView = [[UISwitch alloc] initWithFrame:CGRectMake(0, 0, 94, 27)]; int labelCount = 0; [switchView spelunkAndTag:switchView withCount:&amp;labelCount]; if (labelCount == 2) { [switchView.label1 setText:tag1]; [switchView.label2 setText:tag2]; } return [switchView autorelease]; } @end </code></pre> <p>This is where I add the UISwitch to my tableviewcell:</p> <pre><code>[[contactedCell contentView] addSubview:self.contactedSwitch]; </code></pre> <p>Thanks so much!</p> <p><strong>[Update]</strong> I thought the tableviewcell's might be the problem, so I added these UISwitches to a regular UIView to see how they looked. I have the exact same problem where they look alright in the simulator and the bottom is chopped in the device. So bizarre! </p>
    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.
 

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