Post

Replies

Boosts

Views

Activity

Reply to Segue from search results view controller to another view controller
when you tap on the result row, nothing happens Where is result row (a cell in which table) ? I suppose it is in the table of ResultsTableViewController ? Do I understand correctly that this table can contain either Decks or cards ? Is behaviour different for decks or cards, or is it the same "nothing happens" ? Did you check identifiers are effectively "cardsVC" and "cardDetailVC" (with same upper/lowercase) Could you instrument the code and tell what you get: override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { print("didSelect scope", scope, "indexPath", indexPath) if scope == "Decks" { print("Decks") guard let cardsVC = self.storyboard?.instantiateViewController(identifier: "cardsVC") as? CardsTableViewController else { print("cardsVC was not instantiated") return } cardsVC.selectedDeck = filteredDecks?[indexPath.row] print("cardsVC instantiated, with selectedDeck", cardsVC.selectedDeck) print("self.parent?.navigationController", self.parent?.navigationController) self.parent?.navigationController?.pushViewController(cardsVC, animated: true) } else { print("Cards") guard let cardDetailVC = self.storyboard?.instantiateViewController(identifier: "cardDetailVC") as? NewCardViewController else { print("cardDetailVC was not instantiated") return } cardDetailVC.selectedCard = filteredCards?[indexPath.row] print("cardDetailVC instantiated, with selectedCard", cardDetailVC.selectedCard) print("self.navigationController", self.navigationController) self.navigationController?.pushViewController(cardDetailVC, animated: true) } tableView.deselectRow(at: indexPath, animated: true) } }
Topic: UI Frameworks SubTopic: UIKit Tags:
Jul ’21
Reply to Segue from search results view controller to another view controller
Thanks for additional information. You notice that text is not formatted in comments, so I reformat here: Where is result row (a cell in which table) ? I suppose it is in the table of ResultsTableViewController ? Do I understand correctly that this table can contain either Decks or cards ?  Yep, right, results are cells in ResultsTableViewController, there might be decks or cards, depending on scope.  Is behaviour different for decks or cards, or is it the same "nothing happens" ?  Yes, for both nothing happens.  Did you check identifiers are effectively "cardsVC" and "cardDetailVC" (with same upper/lowercase) - Yes, I checked.  This is the output: navigation controller is nil, I also tried to embed ResultsTableViewController with navigation controller, but it didn't help.  print("didSelect scope", scope, "indexPath", indexPath) didSelect scope Optional("Decks") indexPath [0, 0] print("cardsVC instantiated, with selectedDeck", cardsVC.selectedDeck) print("self.parent?.navigationController", self.parent?.navigationController) Decks cardsVC instantiated, with selectedDeck Optional(Deck { _id = 60e98c5da7d8064df3298f68; name = Greetings; dateCreated = 2021-07-10 12:02:37 +0000; layout = frontToBack; autoplay = 0; cards = List <0x283afcfc0> ( [0] Card { _id = 60e98c63a7d8064df3298f6c; front = hello; back = ; dateCreated = 2021-07-10 12:02:43 +0000; audioName = (null); }, [1] Card { _id = 60e98c6aa7d8064df3298f6d; front = good evening; back = ; dateCreated = 2021-07-10 12:02:50 +0000; audioName = (null); } ); }) self.parent?.navigationController nil didSelect scope Optional("Cards") indexPath [0, 0] Cards cardDetailVC instantiated, with selectedCard Optional(Card { _id = 60e98c6aa7d8064df3298f6d; front = good evening; back = ; dateCreated = 2021-07-10 12:02:50 +0000; audioName = (null); }) self.navigationController nil Now the cause: ResultsTableViewController is not part of the navigation stack, hence its navigationController is nil. In fact, you instantiate directly: let resultsTableController = self.storyboard?.instantiateViewController(withIdentifier: "ResultsTableViewController") as! ResultsTableViewController You could try to add a property in class ResultsTableViewController: UITableViewController { var originatingController: DecksTableViewController? var filteredDecks: Results<Deck>? and set it when you create resultsTableController class DecksTableViewController: UITableViewController { private var searchController: UISearchController! private var decks: Results<Deck>!   override func viewDidLoad() {     super.viewDidLoad() tableView.tableFooterView = UIView() let resultsTableController = self.storyboard?.instantiateViewController(withIdentifier: "ResultsTableViewController") as! ResultsTableViewController resultsTableController?.originatingController = self configureSearchController(resultsTableController) Then call it as: self.originatingController?.navigationController?.pushViewController(cardsVC, animated: true) I could not test, but that should be the logic (may need some tuning though).
Topic: UI Frameworks SubTopic: UIKit Tags:
Jul ’21
Reply to View does not update
Please post the relevant code directly here, don't force us to go and search in the full GitHub project. And explain precisely your set up. what are the different screens where is the save buttons and what does it do ? where are the labels…
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’21
Reply to Swift UIImagePickerController is not sensitive when clicking the Select button
Did you check that the func is called, by adding some print: func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]){ print("func was called") picker.dismiss(animated: true, completion: nil) guard let image = info[UIImagePickerController.InfoKey.editedImage] as? UIImage else { print("image is nil") return } guard let imageData = image.pngData() else { print("imageData is nil") return } Do the same in any place where you return prematurely.
Topic: Programming Languages SubTopic: Swift Tags:
Jul ’21
Reply to app主要语言设置错误如何更换
How to change the app’s main language setting error I chose Traditional Chinese to create the app, and the name is Simplified Chinese. Now add simplified Chinese localization prompt information as follows? Can the app modify the main language Could you explain the problem ? Do you want to make simplified chinese the development language ? If so, have a look here https://stackoverflow.com/questions/25871815/changing-the-development-language-in-xcode/36926728 你能解释一下这个问题吗? 你想让简体中文成为开发语言吗? 如果是这样,请看这里 https://stackoverflow.com/questions/25871815/changing-the-development-language-in-xcode/36926728
Topic: App & System Services SubTopic: Core OS Tags:
Jul ’21
Reply to Animated gifs in forum posts
Did you try to add a file ? It will not be directly visible in the post, but easy to access.
Replies
Boosts
Views
Activity
Jul ’21
Reply to Why are dates all messed up in Google search of Developer Forums??
it says Jun 20, 2020 -- but if I follow the link it shows the question was asked 4 years ago. Google refers to the last update of the post (effectively June 2020). When you open the post (https://developer.apple.com/forums/thread/77005), you see the original question, 4 years old. And the last answer is 12 month old. So, no mess up.
Replies
Boosts
Views
Activity
Jul ’21
Reply to Segue from search results view controller to another view controller
when you tap on the result row, nothing happens Where is result row (a cell in which table) ? I suppose it is in the table of ResultsTableViewController ? Do I understand correctly that this table can contain either Decks or cards ? Is behaviour different for decks or cards, or is it the same "nothing happens" ? Did you check identifiers are effectively "cardsVC" and "cardDetailVC" (with same upper/lowercase) Could you instrument the code and tell what you get: override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { print("didSelect scope", scope, "indexPath", indexPath) if scope == "Decks" { print("Decks") guard let cardsVC = self.storyboard?.instantiateViewController(identifier: "cardsVC") as? CardsTableViewController else { print("cardsVC was not instantiated") return } cardsVC.selectedDeck = filteredDecks?[indexPath.row] print("cardsVC instantiated, with selectedDeck", cardsVC.selectedDeck) print("self.parent?.navigationController", self.parent?.navigationController) self.parent?.navigationController?.pushViewController(cardsVC, animated: true) } else { print("Cards") guard let cardDetailVC = self.storyboard?.instantiateViewController(identifier: "cardDetailVC") as? NewCardViewController else { print("cardDetailVC was not instantiated") return } cardDetailVC.selectedCard = filteredCards?[indexPath.row] print("cardDetailVC instantiated, with selectedCard", cardDetailVC.selectedCard) print("self.navigationController", self.navigationController) self.navigationController?.pushViewController(cardDetailVC, animated: true) } tableView.deselectRow(at: indexPath, animated: true) } }
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to Segue from search results view controller to another view controller
Thanks for additional information. You notice that text is not formatted in comments, so I reformat here: Where is result row (a cell in which table) ? I suppose it is in the table of ResultsTableViewController ? Do I understand correctly that this table can contain either Decks or cards ?  Yep, right, results are cells in ResultsTableViewController, there might be decks or cards, depending on scope.  Is behaviour different for decks or cards, or is it the same "nothing happens" ?  Yes, for both nothing happens.  Did you check identifiers are effectively "cardsVC" and "cardDetailVC" (with same upper/lowercase) - Yes, I checked.  This is the output: navigation controller is nil, I also tried to embed ResultsTableViewController with navigation controller, but it didn't help.  print("didSelect scope", scope, "indexPath", indexPath) didSelect scope Optional("Decks") indexPath [0, 0] print("cardsVC instantiated, with selectedDeck", cardsVC.selectedDeck) print("self.parent?.navigationController", self.parent?.navigationController) Decks cardsVC instantiated, with selectedDeck Optional(Deck { _id = 60e98c5da7d8064df3298f68; name = Greetings; dateCreated = 2021-07-10 12:02:37 +0000; layout = frontToBack; autoplay = 0; cards = List <0x283afcfc0> ( [0] Card { _id = 60e98c63a7d8064df3298f6c; front = hello; back = ; dateCreated = 2021-07-10 12:02:43 +0000; audioName = (null); }, [1] Card { _id = 60e98c6aa7d8064df3298f6d; front = good evening; back = ; dateCreated = 2021-07-10 12:02:50 +0000; audioName = (null); } ); }) self.parent?.navigationController nil didSelect scope Optional("Cards") indexPath [0, 0] Cards cardDetailVC instantiated, with selectedCard Optional(Card { _id = 60e98c6aa7d8064df3298f6d; front = good evening; back = ; dateCreated = 2021-07-10 12:02:50 +0000; audioName = (null); }) self.navigationController nil Now the cause: ResultsTableViewController is not part of the navigation stack, hence its navigationController is nil. In fact, you instantiate directly: let resultsTableController = self.storyboard?.instantiateViewController(withIdentifier: "ResultsTableViewController") as! ResultsTableViewController You could try to add a property in class ResultsTableViewController: UITableViewController { var originatingController: DecksTableViewController? var filteredDecks: Results<Deck>? and set it when you create resultsTableController class DecksTableViewController: UITableViewController { private var searchController: UISearchController! private var decks: Results<Deck>!   override func viewDidLoad() {     super.viewDidLoad() tableView.tableFooterView = UIView() let resultsTableController = self.storyboard?.instantiateViewController(withIdentifier: "ResultsTableViewController") as! ResultsTableViewController resultsTableController?.originatingController = self configureSearchController(resultsTableController) Then call it as: self.originatingController?.navigationController?.pushViewController(cardsVC, animated: true) I could not test, but that should be the logic (may need some tuning though).
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to Can an iPhone app get data from iOS, which designate the location(spot) of apps' icons on the phone's screen ?
AFAIK, maybe you can know there is an icon somewhere (don't know how), but not what app it is, for privacy reason at least.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to Cannot drag cell into empty section collection view
That's an old problem, which is unfortunate. But there is a workaround: create an empty cell, not visible, in each section, so it will never be empty… Details here: https://stackoverflow.com/questions/35920874/swift-unable-to-long-press-drag-cells-to-empty-sections-in-uicollectionviewcont
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to Fatch all video and audio files on local device and put into UItableview
The question was discussed some time ago here: https://stackoverflow.com/questions/18396319/fetch-all-audio-video-files-in-ios Or this https://stackoverflow.com/questions/9061617/access-device-music-files-from-iphone-app-programmatically
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to View does not update
Please post the relevant code directly here, don't force us to go and search in the full GitHub project. And explain precisely your set up. what are the different screens where is the save buttons and what does it do ? where are the labels…
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to How we can use userInteractionEnabled in (number.name) for number only?
Your question is imprecise.  I do not want to edit the number again not edit when what happens ? What is the code you present ? Where is it placed ? What is firstDesign() ? SO please explain the context and your goal more clearly.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to How to refine the shape of an SKSpriteNode for tap gestures?
Lots of calls ? Don't understand your point. Just 4 values to compute and evaluate. Is it part of SpriteKit ? No that's additional code to test where you hit. Surely it can't view every Node as a rectangle or square? What do you mean ?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to How to refine the shape of an SKSpriteNode for tap gestures?
AFAIK, the frame is a rectangle. As you hinted previously, you can shape it using alpha channel: https://developer.apple.com/documentation/spritekit/skphysicsbody/shaping_a_physics_body_to_match_a_node_s_graphics Hence, it will not react to tap outside the shape. Nevertheless, I find that for simple shape as diamond, the test I proposed is really simple.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to Swift UIImagePickerController is not sensitive when clicking the Select button
Did you check that the func is called, by adding some print: func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]){ print("func was called") picker.dismiss(animated: true, completion: nil) guard let image = info[UIImagePickerController.InfoKey.editedImage] as? UIImage else { print("image is nil") return } guard let imageData = image.pngData() else { print("imageData is nil") return } Do the same in any place where you return prematurely.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to app主要语言设置错误如何更换
How to change the app’s main language setting error I chose Traditional Chinese to create the app, and the name is Simplified Chinese. Now add simplified Chinese localization prompt information as follows? Can the app modify the main language Could you explain the problem ? Do you want to make simplified chinese the development language ? If so, have a look here https://stackoverflow.com/questions/25871815/changing-the-development-language-in-xcode/36926728 你能解释一下这个问题吗? 你想让简体中文成为开发语言吗? 如果是这样,请看这里 https://stackoverflow.com/questions/25871815/changing-the-development-language-in-xcode/36926728
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to How we can use userInteractionEnabled in (number.name) for number only?
So, the best is probably to display the names in 2 labels, next to each other. One for the number, that will not be editable (interaction disabled) and the other for the nam itself, editable (interaction enabled). Format the number label on the right, to get a clean display as 1. Java and not 1.     Java
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to How we can use userInteractionEnabled in (number.name) for number only?
I see you just posted the question, but with different issue on S.O. .enabled is a property of the complete textField, not a part of text. What is the problem with the solution I proposed ?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jul ’21