Posts

Post not yet marked as solved
3 Replies
1.2k Views
I have an App in TestFlight that looks wrong because the fonts are too large. The problem shows up only on one tester's iPhone 13 Pro. If I look at the app in the Simulator, it looks as it should. The App in an earlier version looks fine on the user's phone downloaded from the App store. The App also looks fine for a TestFlight user using an iPhone 12. On the problem phone, the font, Avenir Next Condensed, works fine, but it is just too large, so a text heading becomes garbled. Any ideas would be appreciated. https://www.bserg.org/Screen%20Shot%202022-03-24%20at%209.29.32%20AM.png TestFlight on left, Simulator on right.
Posted Last updated
.
Post not yet marked as solved
2 Replies
1.5k Views
I have a UICollectionView child controller embedded in a container view to serve as a photo gallery. I have put a scrollview into the collection view cell and then layered on an imageview. Everything works fine. I can zoom in the cell, but when I move to the edge, the underlying collectionview scrollview takes over and I move to a new page. That's what I want, but I also want to reset the zoom scale (to 1.0) of the cell I just letf. Any suggestions as to how to do this?zooming the cell in the collectionview cell:import UIKitclass PlantPhotoCell: UICollectionViewCell, UIScrollViewDelegate { @IBOutlet weak var imageView: UIImageView! @IBOutlet weak var scrollView: UIScrollView! override func awakeFromNib() { self.scrollView.minimumZoomScale = 1.0 self.scrollView.maximumZoomScale = 4.0 self.scrollView.delegate = self } func viewForZooming(in scrollView: UIScrollView) -> UIView? { return self.imageView }}Cell definition and paging (Paging turned on in Storyboard): override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath ) -> UICollectionViewCell { let cell = collectionView .dequeueReusableCell(withReuseIdentifier: reuseIdentifier, for: indexPath) as! PlantPhotoCell let image = plantImgArray[indexPath.item] cell.imageView.image = image cell.imageView.layer.borderColor = UIColor.white.cgColor cell.imageView.layer.borderWidth = 6 let title1 = UILabel(frame: CGRect(x: 0, y: cell.bounds.size.height - 20, width: cell.bounds.size.width, height:20)) let label = plantDesc[indexPath.item] title1.text = label title1.font = UIFont(name: "AvenirNextCondensed-Medium", size: 20)! title1.backgroundColor = .white title1.textAlignment = .center cell.contentView.addSubview(title1) return cell } override func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) { let pageNumber = round(scrollView.contentOffset.x / scrollView.frame.size.width) pageControl.currentPage = Int(pageNumber) }Thanks for suggestions.
Posted Last updated
.
Post marked as solved
3 Replies
1.1k Views
I am experiencing a problem with the latest version of Xcode, version 11 (now 11.3). I have a tab bar that has one too many items to fit and so has a More list tableview to the final two selections (tabs). This works fine, but when I change the appearance of the UIMoreListTableView, the changes happen when the tableview is not (yet) in the view hierarchy, resulting in a warning. This doesn't appear to cause a problem in practice, but I would like to be able to remove the warning. Here is the text of the warning I get:2019-12-29 07:37:30.880610-0600 DunePlants[1545:546936] [TableView] Warning once only: UITableView was told to layout its visible cells and other contents without being in the view hierarchy (the table view or one of its superviews has not been added to a window). This may cause bugs by forcing views inside the table view to load and perform layout without accurate information (e.g. table view bounds, trait collection, layout margins, safe area insets, etc), and will also cause unnecessary performance overhead due to extra layout passes. Make a symbolic breakpoint at UITableViewAlertForLayoutOutsideViewHierarchy to catch this in the debugger and see what caused this to occur, so you can avoid this action altogether if possible, or defer it until the table view has been added to a window. Table view: <_UIMoreListTableView: 0x10604c000; frame = (0 20; 375 647); clipsToBounds = YES; autoresize = W+H; tintColor = <UIDynamicCatalogColor: 0x2839d4540; name = ERG-green>; gestureRecognizers = <NSArray: 0x283903150>; layer = <CALayer: 0x28374b960>; contentOffset: {0, 0}; contentSize: {375, 88}; adjustedContentInset: {0, 0, 0, 0}; dataSource: <UIMoreListController: 0x105266770>>If I don't try to set the font and tintColor of the More List TableView, I don't get a warning. But I want to use a font and color consistent with my choices for the rest of the App. Here is the code I use:class ERGViewController: UITabBarController { override func viewDidLoad() { super.viewDidLoad() } override func viewDidAppear(_ animated: Bool) { //Next line gets rid of edit button and ability to reorder tabs. moreNavigationController.topViewController?.navigationItem.rightBarButtonItem = nil //If above line is commented out, you need to color the Edit button appropriately moreNavigationController.topViewController?.navigationItem.rightBarButtonItem?.tintColor = UIColor.custom if let moreList = moreNavigationController.viewControllers.first(where: { String(describing: type(of: $0)) == "UIMoreListController" }) { moreList.navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil) moreList.navigationItem.backBarButtonItem?.tintColor = UIColor.custom } tabBarController?.customizableViewControllers = [] if let moreTableView = moreNavigationController.topViewController?.view as? UITableView { moreTableView.tintColor = UIColor.custom for cell in moreTableView.visibleCells { cell.tintColor = UIColor.custom cell.textLabel?.font = UIFont(name: "AvenirNextCondensed-Medium", size: 20) } } }}Is there someplace better to set the font and tintColor?
Posted Last updated
.
Post not yet marked as solved
0 Replies
424 Views
I have an app that features dynamic tableviews that seem to work well on almost every device. Here is a view of an app table on the 11 Pro Max simulator, where everything looks fine.When I run the app on an iPhone XS Max, the thumbnail images get set to the full width of the device, and the accessory views get written over the top, but the title and subtitle get written over. Like this:I tried forcing the image frame to be 44 wide by 44 high, but this seemed to have no effect. The code I used was in cellForRowAt and looked as follows: cell.imageView?.frame = CGRect(x: 0, y: 0, width: 44, height: 44) cell.imageView?.image = UIImage(named: plant.gallery[0])I cannot see if the problem comes in a simulator since Xcode 11.3 doesn't have simulators for the XS Max.So my questions are two. Why doesn't the imageView frame control the image size, and why does the problem only seem to show up with the XS Max (though I haven't seen if it arises for the XS)?
Posted Last updated
.
Post not yet marked as solved
1 Replies
522 Views
I have a tableview that feeds a detail view. The detail view includes a collection view. When I run the app and select a detail view from the table view, the collection view looks fine. But if I return to the tableview and select a different detail view, the detail view updates, but even though the images fed to the collection view are updated (checked by printing them in viewDidLoad), the images in the collection view are the previous images (determined by the inital choice of a detail view). So apparently I need to clean out the reuseable cells, but despite attempts to prepareForReuse and/or reloadData, I must not be doing this correctly. I'd appreciate suggestions about how to force the imageview in my collection view cell to recognize new images.
Posted Last updated
.
Post marked as solved
3 Replies
721 Views
I have an array of strings, call it plants = [Plant](), where each of the strings is a plant characteristic. I read in the plant characteristics from a spreadsheet, breaking each record into individual characteristics with tabs for each cell. One characteristic is an image name that I use for a closeup image. I would like to replace the image name with an array of image names that I pass to a UICollectionView in place of the UIImageView I show for the single image. So I would like to modify the spreadsheet to have a cell that could be either image1, as now, or image1, image2, image 3, ... and read the resulting array in for the collection, which could have one or more images. I have no problem with the collectionview from string literals, but reading in the multiple images would seem to involve mixing an array of strings into my string array, and I am not clear whether that is possible. Is there an obvious way to do this? Sorry for the novice question.
Posted Last updated
.
Post not yet marked as solved
3 Replies
1.5k Views
I have been building an App with a number of images and have found it difficult to obtain information on how large I should save jpgs and how much I should compress them. I understand that the largest 3x screen size is 1242 x 2688 and that for 2x it is 828 x 1792, but that's for full screen. If I were designing for portrait mode, I could reduce those images by using the safe area size assuming I have everwhere a nav bar and a tab bar. I could figure that out, even though there is very little info I can find. But then there is the problem of landscape, where the nav bar is really different and the image is a slice out of the center of the image as designed for portrait. So do I use the width of the safe area in landscape for the biggest phone (right now Xs Max, Xr), and create an image that has the aspect ratio for the vertical dimension set correspondingly? That's a pretty big image, and I am worried about the overall size of the assets catalog. What if I want to be prepared for a universal app, so that I prepare images for the iPads? What I am looking for is advice on how large to make an image that will be in an imageview that takes the whole safe area of a view controller for (at least) iphones and that will not require me to redo all my images with new devices in the near future. Needs to work for portrait and landscape, but cannot be too large. Am I missing some Apple documentation? I am not finding good advice in last year's WWDC videos, but I haven't watched everything, so I'd either like a recommendation for an image size and compression I can feed into, say, GIMP 10.2, or a pointer to more reading. Thanks in advance.
Posted Last updated
.