Post

Replies

Boosts

Views

Activity

How to change the Landscape TabBarItem image
The Documentation for UITabBarItem LandscapeImagePhone says the following,, how can this be used for the selected LandscapeImagePhone. This image can be used to create other images to represent this item on the bar—for example, a selected and unselected image may be derived from this image. You should set this property before adding the item to a bar. The default value is nil. There seems to be no way to change this in DidSelect of the Tabbar controller, doing so gives unpredictable results.
0
0
223
Oct ’23
Xcode 15 / IOS 17 Breaks compact Landscape tab bar
**Run this code on IOS 16 or below, or build with XCode 14, and when you rotate your phone landscape you get a Tab Bar with with labels below the images rather than the default of labels to the left ** extension UITabBar { // the Master view controller shows the UITabBarItem icon next to the text override open var traitCollection: UITraitCollection { if UIDevice.current.userInterfaceIdiom == .pad { return UITraitCollection(horizontalSizeClass: .compact) } // return super.traitCollection if UIDevice.current.userInterfaceIdiom == .phone { return UITraitCollection(horizontalSizeClass: .compact) } return super.traitCollection } } _**_**Build with Xcode 15 and run on IOS 17 Iphone and you get the following error message **_**_ Thread 1: "A trait environment returned a trait collection with unspecified values for traits that are not allowed to be unspecified. This is a serious application bug and will cause undefined behavior. This issue may be caused by your class overriding the traitCollection property getter, which is not supported. Make sure to use the appropriate API if you are trying to override traits. Trait Environment: <UITabBarSwappableImageView: 0x103847660; frame = (0 0; 0 0); opaque = NO; userInteractionEnabled = NO; image = <UIImage:0x281372c70 CGImage anonymous; (34 38)@3>; layer = <CALayer: 0x282135ea0>>; Trait Collection: <UITraitCollection: 0x10386d230; HorizontalSizeClass = Compact, PreferredContentSizeCategory = L>" _____Serious bug? more than 100,000 users over 4 years and never had an issue with this code until now. This is preventing us from building with Xcode 15 and affecting our production. It was suggested we try this, it prevents the crash but does not work.** ____**_ ` ` if UIDevice.current.userInterfaceIdiom == .phone { if #available(iOS 17.0, *) { return UITraitCollection(traitsFrom: [super.traitCollection, UITraitCollection(horizontalSizeClass: .compact)]) } else { return UITraitCollection(horizontalSizeClass: .compact) } } `
6
3
3.2k
Oct ’23
anyone know how to rotate the CMSampleBuffer to landscape
Has anyone figured this out.It seems replaykit 2 always delevers frames at a fixed resolution of 886 x 1918I've tried various solutions to rotate the screen but so far none work.Using the code below crashes in the rotate stepvImageRotate90_ARGB8888(&amp;srcBuffer, &amp;destBuffer, factor, &amp;color, vImage_Flags(0)) let flags = CVPixelBufferLockFlags(rawValue: 0) guard kCVReturnSuccess == CVPixelBufferLockBaseAddress(srcPixelBuffer, flags) else { return nil } defer { CVPixelBufferUnlockBaseAddress(srcPixelBuffer, flags) } guard let srcData = CVPixelBufferGetBaseAddress(srcPixelBuffer) else { print("Error: could not get pixel buffer base address") return nil } let sourceWidth = CVPixelBufferGetWidth(srcPixelBuffer) let sourceHeight = CVPixelBufferGetHeight(srcPixelBuffer) var destWidth = sourceHeight var destHeight = sourceWidth var color = UInt8(0) if factor % 2 == 0 { destWidth = sourceWidth destHeight = sourceHeight } let srcBytesPerRow = CVPixelBufferGetBytesPerRow(srcPixelBuffer) var srcBuffer = vImage_Buffer(data: srcData, height: vImagePixelCount(sourceHeight), width: vImagePixelCount(sourceWidth), rowBytes: srcBytesPerRow) let destBytesPerRow = destWidth*4 guard let destData = malloc(destHeight*destBytesPerRow) else { print("Error: out of memory") return nil } var destBuffer = vImage_Buffer(data: destData, height: vImagePixelCount(destHeight), width: vImagePixelCount(destWidth), rowBytes: destBytesPerRow) let error = vImageRotate90_ARGB8888(&amp;srcBuffer, &amp;destBuffer, factor, &amp;color, vImage_Flags(0)) if error != kvImageNoError { print("Error:", error) free(destData)
3
0
5.2k
Nov ’19