Search code examples
iosiphoneuitableviewios8uiswitch

UISwitch does not show up on UITableView (iOS 8)


I have a UITableView and I have added a UISwitch on a static cell. (The table has sections and static cell). I added an IBOutlet

@property (retain, nonatomic) IBOutlet UISwitch *useWifiSwitch;

and an action using the interface builder in my storyboard.

However the UISwitch does not show when the application is running. I haven't added anything in the viewDidLoad. Anybody has a clue?


Solution

  • Since the universal layout in the Interface Builder is 600x600 but the device isn't, your UISwitch is probably off screen. You can fix it by adding Constraints to the UISwitch.

    Give it a fixed height and then top, bottom and trailing constraints as recommended by the InterfaceBuilder.