[Solved] UILabel position in a UITableViewCell fails on the first try

If I do any complex layout in a UITableViewCell I try to keep it out of cellForRowAtIndexPath. One option is to do layout in – (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath but I prefer to encapsulate layout in a custom UITableViewCell class. Make your own UITableViewCell subclass. Create and add the custom button / label … Read more

[Solved] Switch between dark and light mode (Swift) [closed]

Thanks to your help, I have now managed to do it. @IBAction func system(_ sender: Any) { let window = UIApplication.shared.keyWindow window?.overrideUserInterfaceStyle = .unspecified } @IBAction func dunkel(_ sender: Any) { let window = UIApplication.shared.keyWindow window?.overrideUserInterfaceStyle = .dark } @IBAction func hell(_ sender: Any) { let window = UIApplication.shared.keyWindow window?.overrideUserInterfaceStyle = .light } solved Switch … Read more

[Solved] How can you add padding between views in a UIScrollView in Swift? [closed]

Your constraints are likely not behaving like you expect. My strong suggestion is to use a UIStackView instead, and bind it to the scroll view via constraints, but not your images. let stackView = UIStackView() stackView.axis = .vertical stackView.spacing = 8 // or whatever you want stackView.addArrangedSubview(image1) stackView.addArrangedSubview(image2) scrollView.addSubview(stackView) stackView.translatesAutoresizingMask = false // finish the … Read more

[Solved] How to add UILabel from a loop? [closed]

You should actually create the label and place it on your view. UILabel *display = [[UILabel alloc] init]; display.text = [chars objectAtIndex:i]; display.frame = CGRectMake(x, y, 14, 22); display.textColor = [UIColor whiteColor]; [self.view addSubView:display]; solved How to add UILabel from a loop? [closed]