swift3

UINavigationController, and TabBarController programmatically (no storyboards)

时光总嘲笑我的痴心妄想 提交于 2020-12-28 09:26:53
问题 Currently, my AppDelegate file contains this code to establish the CustomTabBarController as the rootViewController: window = UIWindow(frame: UIScreen.main.bounds) window?.makeKeyAndVisible() window?.rootViewController = CustomTabBarController() I want my app to always have the CustomTabBarController on the bottom, but I want each tab to have a navigation controller. Here is the code I used to set up my tabBarController: class CustomTabBarController: UITabBarController { override func

UINavigationController, and TabBarController programmatically (no storyboards)

喜你入骨 提交于 2020-12-28 09:26:16
问题 Currently, my AppDelegate file contains this code to establish the CustomTabBarController as the rootViewController: window = UIWindow(frame: UIScreen.main.bounds) window?.makeKeyAndVisible() window?.rootViewController = CustomTabBarController() I want my app to always have the CustomTabBarController on the bottom, but I want each tab to have a navigation controller. Here is the code I used to set up my tabBarController: class CustomTabBarController: UITabBarController { override func

print() vs debugPrint() in swift

♀尐吖头ヾ 提交于 2020-12-24 03:51:38
问题 This might be a simple question but because of clear understanding between print() and debug() print in swift I am unable to understand where to use each one. 回答1: You use debugPrint when you want more information about what is being printed to the console. The additional information is usually useful for debugging. print() - Writes the textual representations of the given items into the standard output. debugPrint() - Writes the textual representations of the given items most suitable for

print() vs debugPrint() in swift

荒凉一梦 提交于 2020-12-24 03:50:14
问题 This might be a simple question but because of clear understanding between print() and debug() print in swift I am unable to understand where to use each one. 回答1: You use debugPrint when you want more information about what is being printed to the console. The additional information is usually useful for debugging. print() - Writes the textual representations of the given items into the standard output. debugPrint() - Writes the textual representations of the given items most suitable for

Random Password Generator Swift 3?

半城伤御伤魂 提交于 2020-12-23 06:50:37
问题 I'm building a random password generator for iOS. In it, a button generates a random password that has characteristics chosen by the user (e.g. switches to turn on or off lowercase and uppercase letters, characters and symbols, and so on). The UI looks great, the rest of the code is working smoothly, but I can't get my button to actually generate a random alphanumerical string. I have a label with some placeholder text ("Your Password") that should have its text updated to a random string

Stop repeating UIImage background pattern image - Swift

纵饮孤独 提交于 2020-12-13 04:52:06
问题 I'm using swipe to delete in UITableView. In swipe I need to add image. When I add image it repeats. How to stop repeating func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? { let deleteButton = UITableViewRowAction(style: .default, title: "Delete") { (action, indexPath) in self.tableView.dataSource?.tableView!(self.tableView, commit: .delete, forRowAt: indexPath) return } deleteButton.backgroundColor = UIColor(patternImage:

Change color and back button title of Navigation Bar from Swift 3 code

浪尽此生 提交于 2020-12-12 11:48:12
问题 Making UI of my app using code only. Can't find how customize couple elements: 1. Button 'Back' now it looks like: and it should looks like: So, how I can get rid of 'Back' text from button title, keeping '<' system icon there? And how I can change colors of back button and title of navigation bar? 回答1: try self.navigationController?.navigationBar.tintColor = UIColor.white 回答2: Try: override func viewDidLoad(){ //any other initial stuffs //for the bar navigationController?.navigationBar

User Default Values Changing to Previous Values Seemingly Randomly - Swift

泪湿孤枕 提交于 2020-12-11 05:59:06
问题 I am creating an app that is a game where there is a need to store the high score. I believe (correct me if I'm wrong on this, but this question made it seem this way) that user defaults are the best way to accomplish this. Sometimes when I switch between views in my app, the values change to what they previously were. Then I will switch back to another screen, and they will go back to what they should be. This happens kind-of hit and miss, so it is hard to tell, but I think it happens most

User Default Values Changing to Previous Values Seemingly Randomly - Swift

安稳与你 提交于 2020-12-11 05:56:37
问题 I am creating an app that is a game where there is a need to store the high score. I believe (correct me if I'm wrong on this, but this question made it seem this way) that user defaults are the best way to accomplish this. Sometimes when I switch between views in my app, the values change to what they previously were. Then I will switch back to another screen, and they will go back to what they should be. This happens kind-of hit and miss, so it is hard to tell, but I think it happens most

Core data fetchRequest gives executeFetchRequest:error: <null> is not a valid NSFetchRequest

久未见 提交于 2020-12-10 08:57:07
问题 I while ago, I updated one of my apps to iOS 10, and I got it working, and since then I've been using it on my phone (installed without removing old app, where new app replaced old one). Now when I've removed the app from my iPhone, and reinstalled the same one it doesn't work. I've been trying out to solve this problem by different changes and trying to get an understanding on what is going wrong. I also searched on Google and here on Stack Overflow without any success. The error I get is