Post

Replies

Boosts

Views

Activity

Hide StatusBar on iOS 13.5
In iOS 12 and 13, up to 13.4, few lines of codes:navigationController?.navigationBar.isTranslucent = falsenavigationController?.navigationBar.barTintColor = .blacknavigationController?.navigationBar.tintColor = .redallow to hide the status bar under the navigation bar.With swiftUI is perhaps even simpler.statusBar(hidden: hideStatusBar)but it requires to rewrite the whole app from storyboard to swiftUI.Hiding the status bar, or go to full screen, is still be possible without using swiftUI on legacy code?
Topic: UI Frameworks SubTopic: UIKit Tags:
11
0
10k
Oct ’21
Create a template image
I would add a template image at a button to change its color runtime.I used Preview to draw and save it as a pdf.But it is rendered only as a uniform square color (which color I can change runtimne).How can I obtain the template pdf image?Why the pdf saved by Preview is not working?
4
0
4.4k
Aug ’21
iPad document app into Mac app
Since Xcode 11 setting iPad and Mac in General / Deployment Info fo a target enable it to run in iPad as well as in iMac. When I try to run on the iMac a document app, even the very simple one created by the Xcode on its template, it fails with the error: If the app is a document app running it in a Mac fails with the error: [OpenSavePanels] ERROR: Unable to display open panel: your app is missing the User Selected File Read app sandbox entitlement. Please ensure that your app's target capabilities include the proper entitlements. What have to be added in the project to let a document app running on iPad as well as on iMac?
2
2
2k
Apr ’21
speechSynthesizer delayed by UILongPressGestureRecognizer
I'd have a speech at a begin of a long pressure: class Cell: UITableViewCell { override func awakeFromNib() { ... let willSpeech = UILongPressGestureRecognizer(target: self, action: #selector(longPress(gesture:))) button.addGestureRecognizer(willSpeech) } @objc func longPress(gesture: UILongPressGestureRecognizer) { switch gesture.state { case .began: let utterance = AVSpeechUtterance(string: "hello") let speechSynthesizer = AVSpeechSynthesizer() speechSynthesizer.speak(utterance) ... } } } But the speech start only when the button is released. Is there a way to let the speech start immediately even during a long pressure gesture recogniser?
0
0
756
Mar ’21
Lost space with DoubleColumnNavigationViewStyle in DocumentGroup
DoubleColumnNavigationViewStyle, on iPad, left an unusable space at the top. It seems to be a navigation bar's title, but the navigation bar code apply to the main navigation bar. Is there a way to hide, or at least use, the inner navigation bar? The sample code below reveals part of the screen unused by the App. import UniformTypeIdentifiers @main struct RugbyTimeApp: App { @SceneBuilder var body: some Scene { DocumentGroup( newDocument: {() -> ReferenceDocument in ReferenceDocument()}, editor: {_ -> MainView in MainView()} ) } } struct MainView: View { var body: some View { NavigationView { Text("Side View") .frame(maxWidth: .infinity, maxHeight: .infinity) .background(Color.green) Text("Hello world") .frame(maxWidth: .infinity, maxHeight: .infinity) .background(Color.red) } .navigationViewStyle(DoubleColumnNavigationViewStyle()) .navigationTitle("Nav Title") .toolbar { ToolbarItem(placement: .navigation, content: {Button("Next page", action: {})}) } } } class ReferenceDocument: ReferenceFileDocument { static var readableContentTypes = [UTType.plainText] init() {} required init(configuration: ReadConfiguration) throws {} func snapshot(contentType: UTType) throws -> Int {return 0} func fileWrapper(snapshot: Int, configuration: WriteConfiguration) throws -> FileWrapper { let data: Data = try JSONEncoder().encode(snapshot) return FileWrapper(regularFileWithContents: data) } }
0
0
652
Jan ’21