Post

Replies

Boosts

Views

Activity

Reply to Populating UICollectionView with Images from Camera Roll
Several questions here: override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) - UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "dataCell", for: indexPath) as! GalleryImageCell let asset = images[indexPath.row] let ImageManager = PHImageManager.default() if cell.tag != 0 { ImageManager.cancelImageRequest(PHImageRequestID(cell.tag)) } cell.tag = Int(ImageManager.requestImage(for: asset, targetSize: CGSize(width: 120, height: 120), contentMode: .aspectFill, options: nil, resultHandler: { (result, _) in cell.galleryImage?.image = result })) return cell } line 6, are you sure the tag is 0 ? should add a print to check: if cell.tag != 0 { ImageManager.cancelImageRequest(PHImageRequestID(cell.tag)) print("Exists, tag is", cell.tag) } result is optional. Did you try to unwrap result cell.tag = Int(ImageManager.requestImage(for: asset, targetSize: CGSize(width: 120, height: 120), contentMode: .aspectFill, options: nil, resultHandler: { (result, _) in cell.galleryImage?.image = result ?? UIImage() })) Are you sure to get an image ? To check, try to copy the image in a single UIImageView, to check you get some image. Note: var names should start with lowercase: imageManager vs ImageManager
Topic: UI Frameworks SubTopic: UIKit Tags:
Mar ’21
Reply to How to detect when a user clears all notifications from Notification Center
Not sure to understand exactly what you want. Is there a method that gets called when the "clear" button from notification center is used? I want on that call to reset badge number to 0. Which badge is it ? When you clear, it is automatically reset to zero. Is it a badge in your app ? May have a look here for possible solution: https://stackoverflow.com/questions/48191694/how-to-detect-clear-notifications
Topic: App & System Services SubTopic: Core OS Tags:
Mar ’21
Reply to UITabBarController repeatedly switches to first tab
Have you a mean to extract a simplified project without the library ? Another idea (low probability): does it happen wherever you tap on screen, or only on certain parts ? check all the parameters of the tabBar (in IB). May be some size is too large and cover other parts of the screen ? did you debug the view hierarchy when running in simulator ?
Topic: UI Frameworks SubTopic: UIKit Tags:
Mar ’21
Reply to UITabBarController repeatedly switches to first tab
There are no tapGestureRecognizers anywhere in my code except for that found in a well-known third party library that does not have any known bugs relating to this issue. How can you be so sure ? If you want to force the selected tab, look here https://stackoverflow.com/questions/25325923/programmatically-switching-between-tabs-within-swift and here https://stackoverflow.com/questions/52178000/tapping-on-a-tabbar-item-should-always-open-the-first-view-controller for some hints.
Topic: UI Frameworks SubTopic: UIKit Tags:
Mar ’21
Reply to UIApplication.shared.delegate as? AppDelegate is nil
Please show more code, the full class. How did you define AppDelegate class ? Should be like this, with all the AppDelegate func, such as didFinishLaunchingWithOptions : @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) - Bool {         // Override point for customization after application launch.         return true     } I tested, I get non nil delegate.
Topic: UI Frameworks SubTopic: UIKit Tags:
Mar ’21
Reply to How to schedule local notifications at slightly different times everyday in Swift?
The problem is that you can test only once a day, that makes debugging harder. Very quick reading so far. Have you checked, each day, the values of let sunriseGoldenHourStart = sunlight.calculate(.dawn, twilight: .custom(-4)) let sunsetGoldenHourStart = sunlight.calculate(.dusk, twilight: .custom(6)) Why repeats true, do you really want it to be repeated once user has read ? In anywise, I would try not to repeats false Take care also, if formattedSunsetGoldenHourStart.minute is less than 30, you'll have an error.
Topic: UI Frameworks SubTopic: UIKit Tags:
Mar ’21